read json data in java -
i'm in situation have read json data , insert sqlite table. json data in format :
{ "result": "success", "data": { "userid": "873", "volume": "0.5", "schoolid": "0", "schoolname": "", "preferredlanguageid": "1", "fname": "robin", "lname": "singh", "email": "rob@live.com", "password": "password1111", "isparent": "0", "countryid": "254", "stateid": "143", "state": "", "city": "san diego", "coins": "0", "zip": "", "players": [] } } jsonobject json = new jsonobject(jsonstring); string uname=json.getstring("fname");
but i'm not able first name in string uname.
string uname=json.getstring("fname");
is not working because fname
property nested within data
property. therefore need following:
string uname = json.getjsonobject("data").getstring("fname");
Comments
Post a Comment