Retrieve the values from json string

后端 未结 5 783
忘掉有多难
忘掉有多难 2021-01-26 05:33

I have json string. I want to retrieve the contact from json string. Following json contains array of contacts. here is my json string

5条回答
  •  情深已故
    2021-01-26 05:48

    If you want to stick to JObject and not create classes, look at the example provided at http://weblog.west-wind.com/posts/2012/Aug/30/Using-JSONNET-for-dynamic-JSON-parsing

    You'll have to enumerate over this

    dynamic contacts = (JArray)json["contacts"]
    foreach(dynamic contact in contacts.contact) {
       // look at the fields... 
    }
    

    PS. Give it a go, don't have VS on me so cant quite verify the exact syntax

提交回复
热议问题