在我的Android项目,我有串text
这得到了以下数据:解析JSON在Android和设置在ListView
[
{
"admin": true,
"created_at": "2012-10-16T07:26:49Z",
"email": "[email protected]",
"id": 28,
"language": "fr",
"name": "Marc",
"profile_pic_content_type": null,
"profile_pic_file_name": null,
"profile_pic_file_size": null,
"profile_pic_updated_at": null,
"provider": null
},
{
"admin": false,
"created_at": "2013-04-02T18:47:36Z",
"email": "[email protected]",
"id": 263,
"language": "en",
"name": "Marcus",
"profile_pic_content_type": null,
"profile_pic_file_name": null,
"profile_pic_file_size": null,
"profile_pic_updated_at": null,
"provider": null
}
]
我将它转换成JSON对象得益于此:
JSONObject jsonObj = new JSONObject(text);
我想分析该Json对象,并将其设置在ListView中,但即使使用official documentation我也无法成功完成此操作。
解析后,我想只保留阵列的第一部分,并删除所有领域以外的电子邮件,语言和名称,到底得到这样的:
[
{
"email": "[email protected]",
"language": "fr",
"name": "Marc"
}
]
在json对象内部转换它,尝试解析它,然后将其转换为json对象作为字符串,但仍然没有成功 – sidney
发布代码..相关片段 – Blackbelt
您会笑我。 'Log.e(“retrieve2”,text.toCharArray()[0]);' – sidney