杰森,网络无法正常工作 [英] Json ,net is not working

查看:65
本文介绍了杰森,网络无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用C#中的json net解析一个.我正在使用json .net

I am trying to parse an with json net in c#. And i am using json .net

但是它显示了以下异常

Error reading JArray from JsonReader. Current JsonReader item is not an array: StartObject. Path '', line 1, position 1.

我正在用jquery创建json字符串.字符串的示例如下.

i am creating json string with jquery. And the example of string is as follows.

 {"0":{"tyreId":"","tyreNum":"dsf","tyreSecondHand":"false","tyreReplace":"true"},"1":{"tyreId":"","tyreNum":"gfd","tyreSecondHand":"true","tyreReplace":"true"}}

推荐答案

JSON文档代表具有键"0""1"的对象(JObject).这不是一个真正的数组,而是一个有点模仿数组的对象.

The JSON document represents an object (JObject) with the keys "0" and "1". It is not a true array, but rather an object that somewhat mimics an array.

要么将文档作为对象读取,要么将文档固定为真实数组:

Either read the document as an object, or fix the document to be a real array:

[{"tyreId":"","tyreNum":"dsf","tyreSecondHand":"false","tyreReplace":"true"},{"tyreId":"","tyreNum":"gfd","tyreSecondHand":"true","tyreReplace":"true"}]

这篇关于杰森,网络无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆