如何在JSON中获取单个元素 [英] How to get single element in json

查看:392
本文介绍了如何在JSON中获取单个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在wcf服务中,我在响应中得到json响应,它具有更多元素,但我需要获取单个元素的值.怎么办?
请帮帮我..


我在该服务响应中使用了一个wcf服务,我将格式设置为Json而不是xml,结果我得到了

{description:成功,返回码:0}

在此结果中,我只需要获取成功的值,0 ...如何访问它?

In wcf service i am getting json response in that respone it has more elements but i need to get single element value.How it can be do?
please help me..


I am using one wcf service in that service response,i set the format as Json instead of xml,in the result i am getting

{description:Success,ReturnCode: 0 }

in this result i need to get the value only of success,0...How can i access it?

推荐答案

您可以使用JQUERY提取所需的元素.而不是从头开始编写示例,请参阅此页面,那里有一个示例,该示例从twitter tweet JSON响应中提取元素.

您将看到tweet被传递给回调函数,并且使用tweet.theItem
You could use JQUERY to extract the elements you want. Rather than go and write an example from scratch, refer to this page, where there is an example of extracting the elements from a twitter tweet JSON response.

You will see the tweet, is passed to a callback function and the element is extracted using tweet.theItem


这篇关于如何在JSON中获取单个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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