-1

Possible Duplicate:
Parsing JSON from URL
How to get JSON data from an url in Java?

I have an URL from which I am getting JSON data in an array that I want to parse into string using java. which library is used for parsing data from JSON.

The data which I am getting in an array from URL is like below.

[
{
"id":4,
"firstName":"varun",
"lastName":"",
"addressLine1":"new delhi",
"addressLine2":"",
"landmark":"",
"locality":"AIRPORT",
"pincode":"700003"
}]

Array has no name.

7
  • possible duplicate of Parsing JSON from URL or stackoverflow.com/questions/9994676/… or any of the tenths of questions on Json + Java in SO. Commented Jan 2, 2013 at 10:55
  • Exact duplicate of stackoverflow.com/q/9994676/1065525 Commented Jan 2, 2013 at 10:56
  • question is duplicate but solution dosen't satifies my problem Commented Jan 2, 2013 at 10:58
  • I should post a question: Can I throw a dead cat and not hit a question regarding how to parse JSON with Java? Commented Jan 2, 2013 at 11:15
  • 1
    what's wrong with the answers of the other questions? Commented Jan 2, 2013 at 11:15

1 Answer 1

0

There are many, one of them is Jackson:

ObjectMapper mapper = new ObjectMapper();

// json will contain the JSON in a tree
JsonNode json = mapper.readTree(yourURLObject);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.