-2

I have a Json object like,

{"Id":1492,"name":"Antony","School":"National School"}

Now I need to separate these object. I want to get something like this,

Id = 1492
name = Antony
School = National School

So that I need to store this data separately in db table.

Please help.

Thanks much

madhu
  • 1,010
  • 5
  • 20
  • 38

2 Answers2

0

use http://code.google.com/p/json-simple/

JSONObject json = (JSONObject)new JSONParser().parse("{\"Id\":1492,\"name\":\"Antony\",\"School\":\"National School\"}");
System.out.println("id=" + json.get("Id"));
System.out.println("name=" + json.get("name"));
A Paul
  • 8,113
  • 3
  • 31
  • 61
0

Hope it will help you-

  var data = '{"Id":1492,"name":"Antony","School":"National School"}';
  var json = JSON.parse(data);

  var Id = json["Id"];

or

  var Id = json.Id;
Mandeep Singh
  • 983
  • 8
  • 9