Shashank Lahariya
Shashank Lahariya

Reputation: 109

How to retrieve an element value from json using java?

Here is the json string from which i have to retrieve the element value

{ "search": { "entry": [
{ "d": "op=example.com",
"at": [
{ "name": "id", "value": [ "786786876" ] },
{ "name": "name", "value": [ "usaduas" ] }]
},
{ "d": "op=example.com",
"at": [
{ "name": "id", "value": [ "786876876" ] },
{ "name": "call", "value": [ "gyudyusg" ] }]
},
{ "d": "op=example.com",
"at": [
{ "name": "call", "value": [ "hsadkjhsakjdh" ] },
{ "name": "id", "value": [ "768768768" ] }]
}

I want to retrieve the text from attribute or node "name" : "call". I want to retrieve this value using jsonPath.

Thanks in advance.

Upvotes: 1

Views: 69

Answers (1)

Vikrant Kashyap
Vikrant Kashyap

Reputation: 6836

please try one of these as per your understanding. These two are most convenient and highly used API to Serialize or Deserialize the JSONObject google gson API tutorial-convert-java-object-to-from-json

OR Google Json simple API example-read-and-write-json

Upvotes: 1

Related Questions