Problems with deserialization of JSON in Windows Phone

Source: Internet
Author: User

The original project was the WP8 version. Later, the newtonsoft. JSON. dll was used for an error because of the need to change it to WP7.

I guess it may be caused by different WP project versions. I found wp7.1-specific and still encountered errors such as failure to use methods.

Change the policy and use the built-in C # library to customize a conversion class. If datacontractjsonserializer is used, securityexception is returned.

After searching for Google, we found that the class to be serialized is not set to the public attribute and cannot be converted in WP8. However, errors may occur in versions below.

Not only JSON data, but also XML data. The serialization class must be set to public.

So far, both serialization and deserialization methods have returned to normal, removing the datacontractjsonserializer method.CodeNo need to change.

 

Datacontractjsonserializer in system. runtime. serialization. in the JSON namespace ,. net Framework 3.5 is included in system. servicemodel. web. DLL, you need to add a reference to it ;. NET framework 4 in the system. runtime. serialization.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.