Json
string json = @"{ 'Result': { 'ResponseStatus': { 'IsSuccess': true, 'Errors': [], 'SuccessEntitys': [ { 'Id': 113856, 'Number': '0501050003', 'DIndex': 0 }, { 'Id': 113857, 'Number': '0501050001', 'DIndex': 1 }, { 'Id': 113858, 'Number': '0501050002', 'DIndex': 2 } ], 'SuccessMessages': [], 'MsgCode': 0 }, 'NeedReturnData': [] } }";
一般接口都是回返回json格式的字符串。获取json的数据与返回的数组。首先把返回的json字符串转化为jobject格式
JObject jObject = JObject.Parse(json);
一般获取
var IsSuccess = jObject["Result"]["ResponseStatus"]["IsSuccess"];
获取数组
var list = jObject["Result"]["ResponseStatus"]["SuccessEntitys"]; foreach (var item in list) { var numner = item["Number"].ToString(); }
标签:json,DIndex,Number,Json,var,ResponseStatus From: https://www.cnblogs.com/mvpbest/p/18364808