JSONObject - 如何获取值? [英] JSONObject - How to get a value ?
本文介绍了JSONObject - 如何获取值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 http://json.org/javadoc/org/json/JSONObject一个Java类.html 。
以下是我的代码段。
String jsonResult = UtilMethods.getJSON(this.jsonURL, null);
json = new JSONObject(jsonResult);
getJSON返回以下字符串
getJSON returns the following string
{"LabelData":{"slogan":"AWAKEN YOUR SENSES","jobsearch":"JOB SEARCH","contact":"CONTACT","video":"ENCHANTING BEACHSCAPES","createprofile":"CREATE PROFILE"}}
现在...我怎样才能得到'口号'?
Now...how do I get the value of 'slogan' ?
我尝试了页面上列出的所有方法,但没有一种方法有效。
I tried all the methods listed on the page, but none of them worked.
推荐答案
String loudScreaming = json.getJSONObject("LabelData").getString("slogan");
这篇关于JSONObject - 如何获取值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文