I followed this tutorial on how to decode json with java: https://code.google.com/p/json-simple/wiki/DecodingExamples
In my project i get info_string
:
{"server_ip":"http://localhost:3000/","device_id":14}
that i would like to decode: I tried:
System.out.println(info_string);
=> {"server_ip":"http://localhost:3000/","device_id":14}
Object obj = JSONValue.parse(info_string);
System.out.println(obj);
=> null
JSONArray array=(JSONArray)obj;
=> null
System.out.println(array);
As you can see the array
and obj
variable are null
and contain no data!
What do i wrong? Thanks