Monday, 19 November 2018

read a JSON object in java




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


Answer



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


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...