my web service returns json encoded data to my java application.. how to make the java application read the json_encoded data properly? for example, the returned data looks like this
{“necessities”:-18,”fun”:26,”education”:0.6,”give”:0,”ffa”:3.8,”ltss”:909.6,”message”:array{“1″:33,”2”:44}}
as you can see there’s some nested data inside that.. how can I make the java apps reads the returned string with something like this (if it’s being done in php instead)
echo returndata[“necessities”] and it displays -18
echo returndata[“message”][“1”] and it displays 33
my web service returns json encoded data to my java application.. how to make
Share
In Java everything is an object, so you need to build an object(s) from this JSON string.
You can use this small library:
http://json.org/java/
With that, you are able to build JSONObjects, JSONArrays, etc. and extract all the information you wanted.
Here you have an example: