java - how to group the values in json array to be displayed in a listview? -
how group values in json array displayed in listview? example of arrayjson :`
"caleg": [ { "id": "jk", "tahun": 2014, "nama": "jusuf kalla", "role": "cawapres", "id_running_mate": "jw", "jenis_kelamin": "l", "agama": "islam", "tempat_lahir": "watampone, sulawesi selatan", "tanggal_lahir": "1942-05-15", "status_perkawinan": "kawin", "nama_pasangan": "hj. mufidah yusuf", "jumlah_anak": 5, "kelurahan_tinggal": "", "kecamatan_tinggal": "", "kab_kota_tinggal": "jakarta selatan", "provinsi_tinggal": "dki jakarta"}]"
i want group in custom listview :
how this? because when use hashmap , arrraylist, not work..
with jackson use jsonnode
objectmapper mapper = new objectmapper(); jsonnode rootnode = mapper.readtree(jsonstring); for(jsonnode node: rootnode.getelements()) { //add listview e.g. node.gettextvalue() }
get field names with
rootnode.getfieldnames()
for reading root array check out post
jackson how transform jsonnode arraynode without casting?
source:
Comments
Post a Comment