Grabbing String from Embedded MongoID in JSON Java Android -
i working on grabbing information json. server responds with:
{ "id" : { "$id" : "515a4f1d03cfebb61800097b" }, "body" : "this body" }
i can grab body
string body = json.getstring("body");
but not know how string contained in 'id'.
thanks in advance help!
do not know how string contained in 'id'.
because current jsonobject contains 1 jsonobject , 1 body key. $id
inner jsonobject can as:
jsonobject jsonobj_id=json.getjsonobject("id"); // $id id jsonobject string str_id=jsonobj_id.optstring("$id");
Comments
Post a Comment