【发布时间】:2017-02-06 13:26:44
【问题描述】:
我设法在字符串中获取 JSON 文本,没关系。
看起来像这样:
{"contacts":[{"id":"1","name":"Andrew","surname":"AAAAA","address":"red street 12","phone1":"312312312 ","phone2":"0123232"}, "id":"0","name":"Marco","surname":"Gioia","address":"blue street 3","phone1":" 12345678","phone2":"123456789"}]}
我用来提取名称的方法很简单:
JSONObject nodeRoot = new JSONObject(jsonString);
JSONArray nodeStats = nodeRoot.getJSONArray("contacts");
String name = nodeStats.getJSONObject(i).getString("name");
但是在 cn1 中使用外部 jar 看起来很乱,而且不是您真正想要的。 如何使用 cn1 json 解析器处理这个问题?
谢谢大家
【问题讨论】:
标签: codenameone