【问题标题】:how to get code and message node value from given json message in c#如何从c#中的给定json消息中获取代码和消息节点值
【发布时间】:2021-03-01 05:14:09
【问题描述】:

需要获取code和message的值

{
    "status":null,
    "msg":null,
    "txn":[
        {
            "code":"0",
            "message":"valid.",
            "match":"100",
            "name":null,
            "number":"02100172117301",
            "id":"01"
        }
    ]
}

【问题讨论】:

    标签: c# json .net


    【解决方案1】:

    你可以尝试使用Newtonsoft JSON

    data = JObject.Parse(yourJson);
    string code = data.txn[0].code;
    string message = data.txn[0].message;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-14
      • 2016-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-07
      • 1970-01-01
      相关资源
      最近更新 更多