Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Parsing JSON Object in Java

JSONObject obj = new JSONObject("{interests : [{interestKey:Dogs}, {interestKey:Cats}]}");

List<String> list = new ArrayList<String>();
JSONArray array = obj.getJSONArray("interests");
for(int i = 0 ; i < array.length() ; i++){
    list.add(array.getJSONObject(i).getString("interestKey"));
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Parsing #JSON #Object #Java
ADD COMMENT
Topic
Name
8+1 =