Convert JSON object to simple variables in Java -
i have heavy json lots of parameters want convert java object containing few of them.
direct conversion such this
dataobject obj = gson.fromjson(br, dataobject.class);
is not option.
how can access individual fields within objects (just value
under date
, type
under attributes
under completion_date
)? json example:
{"results":[ {"date":{ "attributes":{ "type":null}, "value":"december 13, 2010"}, "is_structured":"no", "completion_date":{ "attributes":{ "type":"anticipated"}, "value":"march 2016"}, ....
if don't want directly convert input expected object create jsonobject
input like
jsonobject root = new jsonobject(input);
and navigate there attribute need e.g.:
root.getjsonarray("results").getjsonobject(0).getstring("is_structured");
edit: (receive value
under date
)
root.getjsonarray("results").getjsonobject(0).getjsonobject("date").getstring("value");
Comments
Post a Comment