Json parsing and json Parsing

Source: Internet
Author: User

Json parsing and json Parsing

statusJson sj = new statusJson()
{
    ShipmentNum = "555555",
    Status1 = "05",
    Warehouse = "SHANGHAI",
    Company = "AAA"
};
 
List<statusJson> sjlist = new List<statusJson>()
{
    new statusJson()
    {
      ShipmentNum = "555557",
      Status1 = "200",
      Warehouse = "SHANGHAI",
      Company = "AAA"  
    },
    new statusJson()
    {
      ShipmentNum = "555558",
      Status1 = "200",
      Warehouse = "SHANGHAI",
      Company = "AAA"  
    }
};
string getJson = SerializationHelper.ObjecttoJson(sjlist);
 
public string UpdateStatus(string getJson)
{
    List<statusJson> strstatus = JavaScriptHelper.JSONtoObject<List<statusJson>>(getJson);           
    try
    {
        foreach (statusJson st in strstatus)
        {
            string oldstatus = "";
            string newstatus = st.Status1;
            string restatus = reStatus(newstatus);
            string Shipment_ID = st.ShipmentNum;
        }
    }    
}

How can I parse this json file?

Newtonsoft. JSON. dll
Import a namespace to a project

JObject json = JObject. Parse (jsonstring );

Value = json ["name"]. Value <string> (); // use the cyclic Value if multiple values exist.

A json parsing Problem

Your json format is incorrect. If it is correct, alert (data. list) will output something like this "[object]".
Undefined means you have not defined
 

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.