Does a DataContractJsonSerializer generate a Ghost string for JSON keys?

DataContractJsonSerializer is a nice class added to the .net framework that can be used to serialize / desired object in JSON.

Now here is an example I'm trying to do

[Serializable] class User { public string name;     public string userId; }

Now comes the result generated by

Output: notification structure, where instead of the name k__BackingField, only the "name" is expected

Now this is the problem after digging so much that I'm not sure where <> and _BackingField are coming from?

{
"<name>k__BackingField":"test user",
"<userId>k__BackingField":100001}
+3
source share
1 answer

. , , userid.

: , , [Serializable] [DataContract] [DataMember]. :

# JSON

+3

Source: https://habr.com/ru/post/1746557/


All Articles