I'm new learner of java. can anyone assist me how to parse the following json . I want to get data id from the below code :
{"room": {"id": "3","temp": "29"}}
I'm new learner of java. can anyone assist me how to parse the following json . I want to get data id from the below code :
{"room": {"id": "3","temp": "29"}}
I've used GSON http://code.google.com/p/google-gson/ and I believe it's the best,
First you create a class to hold your JSON structure
Class Room {
int id;
int temp;
}
And then you parse your string into a json like this
Gson gson = new Gson();
Room room = gson.fromJson(jsonString, Room.class);