Hello. Fragment JSON strings.
{"Creators":
[
{
"ID": "30322",
"ProfessionKey": "Director"
}
],
[
{
"ID": "1682023",
"ProfessionKey": "Actor"
},
{
"ID": "1876",
"ProfessionKey": "Actor"
}
],
[
{
"ID": "31095",
"PROFESSIONKEY": "PRODUCER"
},
{
"ID": "1093329",
"PROFESSIONKEY": "PRODUCER"
}
]]}
or briefly {"Creators": [[{"ID": "30322", "ProfessionKey": "Director"}], [....]]}
The complexity lies in the next square brackets. I believe that this is a two-dimensional array. I tried different options, c jsonarray, jsonobject. The code below put in GetJsonarray (NULL) “. Please help.
jsonarray creatorscontent = parentobject.getjsonarray ("Creators");
JSonarray FinalArray = CreatorsContent.getjsonobject (0) .Getjsonarray (NULL);
ProfessionKey = CreatorsContent.getString ("ProfessionKey");
Answer 1, Authority 100%
I don’t know which library you use, but in org.json This is done:
jsonarray jsonarray = new jsonobject (jsonstr) .Getjsonarray ("Creators"). GetJsonarray (0);
System.out.PrintLN (jsonarray.get (0) .tostring ());