after sorting by ascending order the below is the json array i am getting
[{"id":0,"dependency":"no","position":0,"Itype":"textinput","label":"t01"},{"id":0,"dependency":"no","position":1,"label":"t02","type":"textarea"},{"id":1,"dependency":"no","position":2,"type":"textinput","label":"t03"},{"id":1,"dependency":"no","position":3,"type":"textarea","label":"t04"}]
I am building up text field or textaaarea according to type or itype in json array but am getting exception "NO value for id"
This is the code so far
//Sorting function called
org.json.JSONArray finalSortedarray=Sort.Sort(formdataArray);
System.out.println("After Function Called Array------------>"+finalSortedarray);
/*for(int v=0;v<finalSortedarray.length();v++){
String sv=(String) formdataArray.getJSONObject(v).get("type");
System.out.println(sv);
}*/
for(int v=0;v<finalSortedarray.length();v++){
JSONObject obj1=(JSONObject)finalSortedarray.getJSONObject(v);
Iterator<String> Nkeys= obj1.keys();
while(Nkeys.hasNext()){
String Nkey=Nkeys.next();
JSONArray Nval=obj.getJSONArray(Nkey);
System.out.println("NVAL IS----->"+Nval);
//formdataArray.getJSONObject(v).get("type");
}
}
Please Help