Loop through a JSON object in Java -



Loop through a JSON object in Java -

i having hard time understanding how loop through below json object

[ {"course_slug":"course-4504","course_description":"a principle refers fundamental truth. establishes cause , effect relationship between t...","course_name":"principles of management","course_thumb":"http:\/\/i1117.photobucket.com\/albums\/k594\/thetutlage\/principles_of-management.jpg?t=1359623785"}, {"course_slug":"course-4502","course_description":"management accounting or managerial accounting concerned provisions , utilize of accoun...","course_name":"management accounting","course_thumb":"http:\/\/i1117.photobucket.com\/albums\/k594\/thetutlage\/management_accounting.jpg?t=1359623495"}, {"course_slug":"course-4503","course_description":"quantitative techniques","course_name":"quantitative techniques","course_thumb":""} ]

you can loop through current json string :

jsonarray jsonarr = new jsonarray("your json string"); for(int = 0; < jsonarr.length(); i++){ jsonobject jsonobj = jsonarr.getjsonobject(i); // course_slug string str_course_slug=jsonobj.getstring("course_slug"); // course_description string str_course_description=jsonobj.getstring("course_description"); //... other elements }

java json

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -