Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>What if you try:</p> <pre><code>Gson gson = new Gson(); FooList vaccines = gson.fromJson(json, FooList.class); </code></pre> <p>What error/exception are you getting?</p> <p><strong>UPDATE:</strong></p> <p>The problem is that you are trying to decode a <code>List</code> of items to an object that contains a list of items. If you want to decode into <code>FooList</code> then your JSON string should look like this:</p> <pre><code>{ "listFoo": [ {"0":"6","ID":"6","1":"USA","Country":"USA","2":"1","Age":"1","3":"Type 5","Type":"Type 5","4":"Brand5","Brands":"Brand5","5":"ashfghdfhhgfdhhdfhhdfg\t\t\t\t\t\t","Contents":"ashfghdfhhgfdhhdfhhdfg\t\t\t\t\t\t","6":"0000-00-00 00:00:00","Time":"0000-00-00 00:00:00"}, {"0":"7","ID":"7","1":"Europe","Country":"Europe","2":"1","Age":"1","3":"Type 5","Type":"Type 5","4":"Brand5","Brands":"Brand5","5":"\t\t\t\tafsfsdgfgh\t\t\t\t\t","Contents":"\t\t\t\tafsfsdgfgh\t\t\t\t\t","6":"0000-00-00 00:00:00","Time":"0000-00-00 00:00:00"}, {"0":"9","ID":"9","1":"USA","Country":"USA","2":"4","Age":"4","3":"Type3","Type":"Type3","4":"Brand4","Brands":"Brand4","5":"sfdsggfhgfhfhg\t\t","Contents":"sfdsggfhgfhfhg\t\t","6":"0000-00-00 00:00:00","Time":"0000-00-00 00:00:00"}, {"0":"10","ID":"10","1":"Europe","Country":"Europe","2":"6","Age":"6","3":"Type3","Type":"Type3","4":"Brand4","Brands":"Brand4","5":"\t\t\t\t\tsfgfdgfhhgfdhghg\t\t\t","Contents":"\t\t\t\t\tsfgfdgfhhgfdhghg\t\t\t","6":"2011-06-03 16:07:08","Time":"2011-06-03 16:07:08"} ] } </code></pre> <p>If you have no choice but to work with the JSON string you've provided, then you could possibly make something like this work:</p> <pre><code>List listOfObjects = g.fromJson(json, List.class); for(Object obj : listOfObjects) { FooList.listFoo.add((Foo) obj); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload