VS2015 读取嵌套JSON 出错
在 JArray jarry = JArray.Parse(jo["supplierStock"].ToString()); 这一步报错
Error reading JArray from JsonReader. Current JsonReader item is not an array: StartObject
TextBox1.Text 中获取的值如下
{"supplierStock":
{"shoppingCount":0,
"productId":169253,
"productName":"五分裤",
"categorySecondaryId":24,
"productCode":"S20252070",
"stockId":1193485,
"stockSkuList":[{"shapeCode":"",
"skuPrice":199.00,
"norms1Value":"默认",
"norms2Value":"默认",
"ownerId":2971,
"skuCount":0,
"type":1
}],
"supplierId":2971,
"onlineSellCount":0,
"previewJson":"http://static.qiakr.com/FtZ3aDqod9yWaHCzVbDsxoW7VqBe,http://static.qiakr.com/FpWl17ZGCGw0Is8UZC001JxTc9td,http://static.qiakr.com/FkA128OXGovvkY_oQhhMENs6uJIr,http://static.qiakr.com/Fg6TiWFvwyczYdc5Q5nbx5dMXqs_,http://static.qiakr.com/Fs4kyZe7eyV5jgjEfUhVSlNJQb1x",
"tagPrice":299.00,
"productUrl":"http://static.qiakr.com/FtZ3aDqod9yWaHCzVbDsxoW7VqBe",
"commissionRate":null,
"minSkuPrice":199.00,
"maxSkuPrice":199.00,
"count":0,
"description":"<img src=\"http://static.qiakr.com/FiJJwglJBtHEzu8YDTVkHDXYl0NZ\" /><img src=\"http://static.qiakr.com/FvWisoImfNORD9nccFX6Uc61O7Gi\" /><img src=\"http://static.qiakr.com/FhayV3gnNpHEVgi5OOpLC6R80MZi\" /><img src=\"http://static.qiakr.com/FjqBVzv3vZs-8G7rk-0ABMv-Jc07\" /><img src=\"http://static.qiakr.com/Fso4gdT0K0tniTYzphGEIjW-cMIx\" /><img src=\"http://static.qiakr.com/FhAGDAGxHnVAnUkRR8e2Y8xD3VBy\" /><img src=\"http://static.qiakr.com/FgvoiGBeT_53KUoYRyghEW_n7wYb\" /><img src=\"http://static.qiakr.com/FnKExLcZTLTwZUFp7VRLlDFmD3SR\" /><img src=\"http://static.qiakr.com/FtcGIudPqUoK5Q99maLaBYC_Jklo\" /><img src=\"http://static.qiakr.com/FlbUXFhfuNzduwueTbIxqkAylJhi\" /><img src=\"http://static.qiakr.com/Fsgyf4UTrEs-DdZbm5sN7Vk7O8Hq\" />",
"status":0
},
"code":0,"msg":"success"}
Error reading JArray from JsonReader. Current JsonReader item is not an array: StartObject
/// <summary>
///获取商品详情JSON
/// </summary>
/// <returns></returns>
public JArray LoadProductInfoJson()
{
JObject jo = (JObject)JsonConvert.DeserializeObject(TextBox1.Text);
JArray jarry = JArray.Parse(jo["supplierStock"].ToString());//supplierStock
for (var i = 0; i < jarry.Count; i++)
{
JObject j = JObject.Parse(jarry[i].ToString());
JArray jarry1 = JArray.Parse(j["stockSkuList"].ToString());//stockSkuList
for (var k = 0; k < jarry1.Count; k++)
{
JObject jk = JObject.Parse(jarry1[k].ToString());
}
}
return jarry;
}
TextBox1.Text 中获取的值如下
{"supplierStock":
{"shoppingCount":0,
"productId":169253,
"productName":"五分裤",
"categorySecondaryId":24,
"productCode":"S20252070",
"stockId":1193485,
"stockSkuList":[{"shapeCode":"",
"skuPrice":199.00,
"norms1Value":"默认",
"norms2Value":"默认",
"ownerId":2971,
"skuCount":0,
"type":1
}],
"supplierId":2971,
"onlineSellCount":0,
"previewJson":"http://static.qiakr.com/FtZ3aDqod9yWaHCzVbDsxoW7VqBe,http://static.qiakr.com/FpWl17ZGCGw0Is8UZC001JxTc9td,http://static.qiakr.com/FkA128OXGovvkY_oQhhMENs6uJIr,http://static.qiakr.com/Fg6TiWFvwyczYdc5Q5nbx5dMXqs_,http://static.qiakr.com/Fs4kyZe7eyV5jgjEfUhVSlNJQb1x",
"tagPrice":299.00,
"productUrl":"http://static.qiakr.com/FtZ3aDqod9yWaHCzVbDsxoW7VqBe",
"commissionRate":null,
"minSkuPrice":199.00,
"maxSkuPrice":199.00,
"count":0,
"description":"<img src=\"http://static.qiakr.com/FiJJwglJBtHEzu8YDTVkHDXYl0NZ\" /><img src=\"http://static.qiakr.com/FvWisoImfNORD9nccFX6Uc61O7Gi\" /><img src=\"http://static.qiakr.com/FhayV3gnNpHEVgi5OOpLC6R80MZi\" /><img src=\"http://static.qiakr.com/FjqBVzv3vZs-8G7rk-0ABMv-Jc07\" /><img src=\"http://static.qiakr.com/Fso4gdT0K0tniTYzphGEIjW-cMIx\" /><img src=\"http://static.qiakr.com/FhAGDAGxHnVAnUkRR8e2Y8xD3VBy\" /><img src=\"http://static.qiakr.com/FgvoiGBeT_53KUoYRyghEW_n7wYb\" /><img src=\"http://static.qiakr.com/FnKExLcZTLTwZUFp7VRLlDFmD3SR\" /><img src=\"http://static.qiakr.com/FtcGIudPqUoK5Q99maLaBYC_Jklo\" /><img src=\"http://static.qiakr.com/FlbUXFhfuNzduwueTbIxqkAylJhi\" /><img src=\"http://static.qiakr.com/Fsgyf4UTrEs-DdZbm5sN7Vk7O8Hq\" />",
"status":0
},
"code":0,"msg":"success"}
...全文
相关推荐
JsonCpp 编译库lib dll 示例代码VS2015版
本资源为JsonCpp编译库测试代码,内含x86,x64版本的静态lib库,动态Dll库,及引用头文件,测试运行代码。本人专门整理供大家使用,减少不必要的麻烦。谢谢支持。
VS2015离线安装报错‘安装包丢失或损坏‘的完整修复指南
在Windows离线部署场景中,安装包完整性校验是确保软件正常部署的基础环节。VS2015采用传统的MSI加CAB包结构,安装引导器通过哈希校验和数字签名双重机制验证packages目录下的组件文件。当文件缺失、路径过长或系统组件不满足要求时,校验失败会直接导致安装中断。理解这一校验原理,不仅能快速定位VS2015离线安装中'安装包丢失或损坏'的根因,也能为其他离线部署场景提供排查思路。本文针对VS2015离线安装场景,系统梳理了布局下载不完整、中文路径解析异常、安全软件拦截及系统组件缺失四类典型触发原因,
百度ocr vs2015版本
百度ocr vs2015版本,需要将编译设置成MT。解决json解析出现\u开头中文乱码问题。代码和库都齐全
用vs2015编译好的百度ocr c++依赖库
可以直接使用的编译好的openssl、json、curl库,百度api需要自己到官网下载
protobuf vs2015版本动态库
window下qt使用protobuf,vs2015编译动态库,测试了下,仅支持proto2,对proto3编译有误。


