JSON Response in Servlet

JSON (JavaScript Object Notation) is a lightweight data-interchange format. it is widely used nowadays in Restful web service because it is light weight compare to xml response. It is easy for humans to read and write. It is easy for machines to parse and generate. We have java based json framework(GSON , Jackson Mapper etc), which are responsible for converting JSON into java object and java object into JSON format.

 JSON sample format :-
json-format


Ajax Example with JSON Response by Servlet :-


ajax-in-servlet