Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/319.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 检索从WCF rest服务返回的JSON数据_C#_Jquery_Json_Web - Fatal编程技术网

C# 检索从WCF rest服务返回的JSON数据

C# 检索从WCF rest服务返回的JSON数据,c#,jquery,json,web,C#,Jquery,Json,Web,可能重复: 我已经使用jsonlint验证了返回的json,它是有效的。举个简单的例子 “JSONDataResult”:“{\”?xml\”:{\“@version\”:“1.0\”,“@encoding\”:“utf-8\”,“Root\”:{\“Information\”:{\“Error\”:{\“ErrorNo\”:“0\”,,“Address\”:{“Address\”:[{\“\AddressID\”:“1232233\,“,\”,“Sequence\”:“1\,“,“,”描述:

可能重复:

我已经使用jsonlint验证了返回的
json
,它是有效的。举个简单的例子

“JSONDataResult”:“{\”?xml\”:{\“@version\”:“1.0\”,“@encoding\”:“utf-8\”,“Root\”:{\“Information\”:{\“Error\”:{\“ErrorNo\”:“0\”,<“ErrorMsg\”:null>,“Address\”:{“Address\”:[{\“\AddressID\”:“1232233\,“,\”,“Sequence\”:“1\,“,“,”描述:”:“公司、县、市、街道、大厦、街道、街道、代码:”>

…这里有更多数据和所有正确的标签等

使用下面的方法返回上面的数据结构,但我不能将其分解为组件

      $.getJSON('http://localhost/WcfRestService/RestServiceImpl.svc/json/mypostcode', 
       function (data) {
          //tried all sorts of variations of this sort of thing: data.Root.Information.Address.Address[0]
    });

如果您有任何想法,我将不胜感激。

我将尝试找出接收到的json结构的真实外观。只需将数据调试到控制台或编写一个警报向您显示。我猜您需要调用:

data.JSONDataResult.Root…

data.d.JSONDataResult.Root…


访问“Root”属性。

粘贴时JSON无效:您可能应该提供有关它的更多信息。我想从每个地址字段中获取地址。现在没有乐趣。您接受了有什么问题吗?现在JSON是通过wcf rest服务返回的,而不是http处理程序返回的信息技术