Where jsonObj is a JSONObject that contains some data. According to this following code, you can only get field names, if you want for column values, then you can add additional values ββfor keys.
List<String> listArray = new ArrayList<String>(); Iterator iter = jsonObj.keys(); int count=0; while(iter.hasNext()){ listArray.add((String)iter.next()); count +=1; } System.out.println(listArray); output: [projector, video_conference, polycom, lcd, digital_phone, speaker_phone]
source share