Parsing of JSON in foreground

Source: Internet
Author: User

#region JavaScriptSerializer

This is a form of serialization that comes with C #
JavaScriptSerializer serializer = new JavaScriptSerializer ();
List<product> Objs = serializer.deserialize<list<product>> (name);
#endregion

#region JsonConvert

Use of third-party
list<product> jobinfolist = jsonconvert.deserializeobject<list<product>> (name);
#endregion

Use an array to accept and then turn the array into an object
Jarray JavaScript = (jarray) jsonconvert.deserializeobject (name);
list<string> list = new list<string> ();
for (int i = 0; i < JavaScript. Count; i++)
{
Jobject obj = (jobject) javascript[i];
String outvalue = obj["Name"]. ToString (); Converts an array of deserialized JSON strings into objects
List. ADD (Outvalue);
}

    1. Public static list<t> jsonstringtolist<t> (this string jsonstr)
    2. {
    3. JavaScriptSerializer serializer = new JavaScriptSerializer ();
    4. List<t> Objs = serializer.deserialize<list<t>> (JSONSTR);
    5. return OBJS;
    6. }

Parsing of JSON in foreground

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.