parse json rest response in java -
i trying parse json output neo4j in java as:
object obj = parser.parse(new filereader("d:\\neo4j.json")); jsonarray json = (jsonarray) obj; system.out.println(json.size()); (int = 0; < json.size(); i++) { jsonobject jsonobject = (jsonobject) json.get(i); string data = (string); jsonobject.get("outgoing_relationships"); string name = (string) jsonobject.get("name"); system.out.println(data); system.out.println(name); }
can me values inside "data" element:
i have json output neo4j follows:
[{ "outgoing_relationships": "http://host1.in:7474/db/data/node/133/relationships/out", "data": { "mothers_name": "parveen bagem", "mobile_no": "9211573758", "gender": "m", "name": "mohd", "tel_no": "0120-", "pincode": "110001" }, "traverse": "http://host1.in:7474/db/data/node/133/traverse/{returntype}", "all_typed_relationships": "http://host1.in:7474/db/data/node/133/relationships/all/{-list|&|types}", "property": "http://host1.in:7474/db/data/node/133/properties/{key}", "self": "http://host1.in:7474/db/data/node/133", "properties": "http://lhost1.in:7474/db/data/node/133/properties", "outgoing_typed_relationships": "http://host1.in:7474/db/data/node/133/relationships/out/{-list|&|types}", "incoming_relationships": "http://host1.in:7474/db/data/node/133/relationships/in", "extensions": { }, "create_relationship": "http://host1.in:7474/db/data/node/133/relationships", "paged_traverse": "http://host1.in:7474/db/data/node/133/paged/traverse/{returntype}{?pagesize,leasetime}", "all_relationships": "http://host1.in:7474/db/data/node/133/relationships/all", "incoming_typed_relationships": "http://host1.in:7474/db/data/node/133/relationships/in/{-list|&|types}" }]
regards, jayendra
you can try following way. inside loop data node jsonobject. data node can extract every property. extracted mother name data.
jsonobject data = (jsonobject) jsonobject.get("data"); final string mothername = (string) data.get("mothers_name");
Comments
Post a Comment