我正在开发一款Android app&在解决JSON解析方面有一个问题。我没有时间,所以我粘贴了JSON。我想知道在数组中保存每个字段的最简单方法,以便我可以在ListView
中使用它。
JSON如下所示:
[{
"data": {
"matrimony_id": "D1444256445",
"profile_for": "groom",
"name": "himan",
"gender": "female",
"date_of_birth": "1992-07-15 00:00:00",
"religion": "Hinduism"
},
"age": 23,
"height": "5.8",
"education": ",",
"personal": ",,",
"images": "b6.jpg"
},
{
"data": {
"matrimony_id": "D1449242567",
"profile_for": "bride",
"name": "ruchi ",
"gender": "female",
"date_of_birth": "1992-12-30 00:00:00",
"religion": "Hinduism"
},
"age": 23,
"height": "5.8",
"education": ",",
"personal": ",,",
"images": "i.jpg"
},
{
"data": {
"matrimony_id": "D1449303182",
"profile_for": "groom",
"name": "Himanshu Mandloi",
"gender": "male",
"date_of_birth": "0000-00-00 00:00:00",
"religion": "Hinduism"
},
"age": 2016,
"height": "5.8",
"education": ",",
"personal": ",,",
"images": "download.jpg"
},
{
"data": {
"matrimony_id": "D1450940648",
"profile_for": "groom",
"name": "abhilash",
"gender": "male",
"date_of_birth": "1988-11-11 00:00:00",
"religion": "Hinduism"
},
"age": 27,
"height": null,
"education": ",",
"personal": ",,",
"images": null
},
{
"data": {
"matrimony_id": "D1450956081",
"profile_for": "bride",
"name": "Hitesh Singhal",
"gender": "male",
"date_of_birth": "0000-00-00 00:00:00",
"religion": "Hinduism"
},
"age": 2016,
"height": "5.8",
"education": ",",
"personal": ",,",
"images": null
},
{
"data": {
"matrimony_id": "D1452002747",
"profile_for": "groom",
"name": "him",
"gender": "male",
"date_of_birth": "1992-02-09 00:00:00",
"religion": "Hinduism"
},
"age": 24,
"height": null,
"education": ",",
"personal": ",,",
"images": null
},
{
"data": {
"matrimony_id": "D1455696296",
"profile_for": "bride",
"name": "sunita tripathi",
"gender": "female",
"date_of_birth": "1985-05-14 00:00:00",
"religion": "Hinduism"
},
"age": 30,
"height": null,
"education": ",",
"personal": ",,",
"images": null
}]
答案 0 :(得分:0)
我没有得到,你面临的确切问题。但我有这个想法,你在询问如何在ListView中使用JsonArray。
您是否尝试过考虑json对象的数组,例如JsonObject [] array = [your array]
为列表视图实现ArrayAdapter。您将把json数组传递给适配器,并在列表视图中设置适配器。