how can we read a JSON object in a JSP , Servlet or in any other java program?
+4
A:
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
John Paulett
2009-11-25 16:15:15
+1
A:
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.
Kevin
2009-11-25 16:15:47
That's a good page -- not sure the ref impl is all that great (almost all alternatives from the page are better IMO), but it's good it has been available for years now, and has encourages others to implement better alternatives. :-)
StaxMan
2009-11-26 06:24:49
+1
A:
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.
Andy
2009-11-25 16:15:51
+2
A:
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: http://stackoverflow.com/questions/1688099/converting-json-to-java/1688182#1688182
BalusC
2009-11-25 17:22:28