JsonConvert Serialization Problems

Source: Internet
Author: User

The JSON data returned is as follows:

[[1400025600,9633460,9667535,2698.09,2734.73,2749,2698.08,25333.3057,11784.9,13548.4,69148900],[ 1400112000,9667536,9700700,2734.94,2771.01,2790,2731.48,24260.1011,11824.5,12435.6,67093300],[ 1400198400,9700701,9736706,2771,2789,2816.33,2730,34824.2351,17912.2,16912,96751200],[ 1400284800,9736707,9752556,2789,2782.03,2800,2775,9279.0273,4603.73,4675.29,25840300]]

Use: Dynamic Jsonrespot = jsonconvert.deserializeobject<expandoobject> (Resposedata); When parsing, the following error is reported:

Cannot deserialize the current JSON array (e.g. [+]) into type ' System.Dynamic.ExpandoObject ' because the type require S a JSON object (e.g. {"Name": "Value"}) to deserialize correctly.

To fix this error either change the JSON to a JSON object (e.g. {"Name": ' Value '}) or change of the deserialized type to an AR Ray or a type that implements a collection interface (e.g. ICollection, IList) like list<t>, can is deserialized From a JSON array. Jsonarrayattribute can also is added to the type of force it to deserialize from a JSON array.

Path ', line 1, position 1.

The workaround is serialized with the following statement:

Jarray jsonobj = (jarray) jsonconvert.deserializeobject (resposedata);

JsonConvert Serialization Problems

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.