java - Android deserialize String to a JSONObject without using libraries -
is there way convert json has been serialised string, jsonobject, without having install additional libraries.
i have json:
{ "asd": false, "qwe": false, "zxc": false, "qaxz": false, "asdqwe": false, "asdqwe": false, "wexd": false } embedded string json object ("user") , name "app_settings"
then seek this:
jsonobject settings = user.getjsonobject(jsonkeys.user_settings); here exception get:
06-20 12:15:19.105: w/system.err(17085): org.json.jsonexception: value {"asd":false,"qwe":false,"zxc":false,"qaxz":false,"asdqwe":false,"asdqwe":false,"wexd":false} @ app_settings of type java.lang.string cannot converted jsonobject solution
changed:
jsonobject settings = user.getjsonobject(jsonkeys.user_settings); to
jsonobject settings = new jsonobject(user.getstring(jsonkeys.user_settings)); and worked
you can do
jsonobject obj = new jsonobject(your_string)
java android
No comments:
Post a Comment