DeserializeObject<字典< string,object> JSON字符串
我有这个JSON请求,
{
"status": "completed",
"test":"hi",
"order":{
"name":"book",
"qty":"2"
},
"customer":{
"name":"sajid",
"address":"salmiya"
},
"products":{
"name":"abc",
"qty":"1"
}
}
我已经使用此请求了JSON
Dictionary<string, object> values = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(test);
,但我无法获得产品名称和数量的值 我想要客户的价值。
I have this JSON request
{
"status": "completed",
"test":"hi",
"order":{
"name":"book",
"qty":"2"
},
"customer":{
"name":"sajid",
"address":"salmiya"
},
"products":{
"name":"abc",
"qty":"1"
}
}
I have already Deserialized JSON using this
Dictionary<string, object> values = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(test);
But I am unable to get the values of product name and quantity
and similar way I want the values for customer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在您的字典中,键是字符串类型,但值为局限。要获取数据,您必须将字典价值施加到
In your dictionay a key is a string type, but a value is JObject. To get data you have to cast a dictionary value to JObject