read a JSON object in java

13,461

Solution 1

I would recommend using Gson for this. It has the advantage that it supports generics very well and it is also performant. I've posted a Gson#fromJson() example before here: Converting JSON to Java

Solution 2

With the json library, there is a JAR of it located here. Also, based upon this answer, you might want to look at JSON-lib

Solution 3

JSON.org has a lot of good information on reading JSON in Java (and other languages as well). They provide a good reference implementation that many other libraries use.

Solution 4

Take a look at Jackson.

Solution 5

Using a library such as the one described at: http://www.json.org/java/

Looking at the description of gson, it certainly looks like it would do the job as well.

Share:
13,461
Sadesh Kumar N
Author by

Sadesh Kumar N

Updated on June 05, 2022

Comments

  • Sadesh Kumar N
    Sadesh Kumar N almost 2 years

    How can we read a JSON object in a JSP, Servlet or in any other Java program?