This article is a mirror article of machine translation, please click here to jump to the original article.

View: 21827|Reply: 0

[Source] Newtonsoft.Json is not serializing object properties properly

[Copy link]
Posted on 6/30/2017 2:09:51 PM | | | |

I found that with Json.net I can't serialize some object properties。。。。。 Then, adding "Serializable" doesn't work either

However, I did not add the characteristics of ignoring attributes, and many people on the Internet are looking for answers on how to ignore some attributes.

I use.net's built-in json serialization method, I tried it and found it to be normal, as shown in the figure below:



I didn't find any articles about json not serializing attributes normally, only one that solved my doubts

When serializing ccc, cName is not serialized!



Since the parent class pcc of ccc defines a DataContract, it is requiredAll properties of a subclass need to define a DataMember before they can be serialized。 Otherwise, it is handled by IgnoreDataMember.




Get it




Previous:asp.net mvc json Time/Date(xx) Conversion (2)
Next:php array output json shows blank
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com