如何在c#中获取json数据的值

时间:2017-11-29 09:41:13

标签: c# json

我通过webservice获取json数据..我想把数据从 lstResponsewrap 放入c#中的表或Repeater ..如何做到这一点..

    {
    "Success": true,
    "Status": "Success",
    "serviceLogs": [],
    "PaymentTerms": [
        {
            "strUnitName": "TS MSQ JN1-12-1201",
            "propertyInventoryId": "a0KP0000001fwB3MAI",
            "lstResponsewrap": [
                {
                    "TERMDAYS": "0",
                    "TERMDATE": "2017-11-29",
                },
                {
                    "TERMDAYS": "1",
                    "TERMDATE": "2017-10-3",
                }],
              }]}

c#代码

        using (var response = httpReq.GetResponse())
        {
            Stream dataStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(dataStream);
            string dr = reader.ReadToEnd();

             var myRoot = JsonConvert.DeserializeObject<RootObject>(dr);
            var roote = myRoot.PaymentTerms;

        }

0 个答案:

没有答案