Dev Loppeur Dev Loppeur - 3 months ago 5x
JSON Question

extract from a multiple json

I have a json like this:


every "sub-json" I want to convert it to Model object.(an object that contains as attributes id value and date).
How can I do it?
Thank you.


You got an array of objects.

JSONArray jsonarray = new JSONArray(jsonStr);
for (int i = 0; i < jsonarray.length(); i++) {
   JSONObject jsonobject = jsonarray.getJSONObject(i);
   String id = jsonobject.getString("id");
   String value = jsonobject.getString("value");