这是JSONArray: String json = [{“1”:“Kenny”,“2”:“Tom”,“3”:“Mosoti”}]; 现在我想要一个字符串数组的值只有例如肯尼,汤姆,莫索蒂如何从JSONArray中检索值
回答
您可以使用任何json解析器来做到这一点,例如Jackson。
编写自己的解析器不是一个好的选择,因为它很容易出错。也不要重新发明轮子。
am使用这个包org.json。* – user1759570
帮我使用包 – user1759570
@ user1759570看看[这里](http://stackoverflow.com/questions/6402115/parse-json-array) –
呀,你应该像杰克逊主流库/框架去,你可以阅读更多关于它在这里:http://wiki.fasterxml.com/JacksonInFiveMinutes
一个基本的例子是这样的:
private static MailData unMarshallJson(String literalJson) throws JAXBException, IOException {
Data data = null;
ObjectMapper mapper = new ObjectMapper();
data = mapper.readValue(literalJson, Data.class);
return data;
}
其中数据类是一个对应于解析数据的类,请阅读我提供的链接以获取更多信息。
- 1. 从Java检索JSONArray(Android)
- 2. 如何检查JSONArray中的特定值?
- 3. 如何从jsonarray读取值?
- 4. Parse.com:从服务器检索JSONArray和JSONObject
- 5. 如何在JSONARRAY中从JSONOBJECT获取值?
- 6. 如何检查JSONArray
- 7. 如何在检索一个值之后从列中检索值
- 8. 如何从RadNumericTextBox检索值
- 9. 如何从JSONArray
- 10. 如何从Application.properties中检索值?
- 11. 如何从UIColor中检索灰度值?
- 12. 如何从$ user中检索状态值?
- 13. 如何从iPhone中的nsdictionary检索值?
- 14. 如何从stdClass对象中检索值?
- 15. 如何从Nsobject中检索Nsstring值?
- 16. 如何从控制器中检索值?
- 17. 如何从URL中检索值?
- 18. 如何从注册表中检索值?
- 19. 如何从json输出中检索值?
- 20. 如何从NSDictionary中检索值?
- 21. 如何从组件中检索值
- 22. 如何从其他表中检索值?
- 23. 如何从Map中检索值?
- 24. 如何从QuietlyCoding的NumberPicker中检索值?
- 25. 如何从PHP数组中检索值?
- 26. 如何从json中检索值
- 27. 如何从散列中检索值?
- 28. 如何从chrome.storage中检索这个值?
- 29. 如何从数据库中检索值?
- 30. 如何在Codeigniter中从form_dropdown()检索值
你使用什么语言? – Vrushank
使用android java – user1759570