JSON 对象帮助
{
"accuracy": 0.17,
"dogr": 108,
"dogt": 22,
"elo0": 602.29,
"elo1": 587.28,
"games": 305
}
我从 JSON 对象中获取了上面的这些值,
JObject general = (JObject)bfbc_array[0]["general"];
foreach (float generalsNumbers in general.PropertyValues())
{
listBox7.Items.Add(generalsNumbers);
}
该循环遍历该对象,我可以检索每个值的数量。这是完美的,但是我也想检索文本,但我完全被难住了。我需要使用什么才能获得文本? (我使用的是 JSON.NET)
{
"accuracy": 0.17,
"dogr": 108,
"dogt": 22,
"elo0": 602.29,
"elo1": 587.28,
"games": 305
}
I have those values above from JSON Object,
JObject general = (JObject)bfbc_array[0]["general"];
foreach (float generalsNumbers in general.PropertyValues())
{
listBox7.Items.Add(generalsNumbers);
}
That loop iterates through the object and I can retrieve the number of each one. Which is perfect, however I want to retrieve the text as well and I'm completely stumped. What do I need to use so that I can get the text as well? (I am using JSON.NET)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够按如下方式循环
general
:如果您需要数字为
float
类型,您可以对它们进行转换:You should be able to loop over
general
as follows:If you need the numbers to be of type
float
you can cast them: