Reputation: 157
How do I use JSON in java servlet? Using the URL, to pass parameters from a POST servlet, the JSON would respond based on the URL parameters.
Upvotes: 0
Views: 1112
Reputation: 181280
You need a JSON library in Java. With that library, you will be able to serialize Java Objects into JSON objects, and send them through HttpServletResponse
instance in your Servlet.
Upvotes: 2
Reputation: 103797
"How do you use it"?
JSON is simply one way of representing hierarchical data (such an an object model) in a flat text format (such as an HTTP body, or filesystem file). So you'd use it to represent hierarchical data in these situations.
If you mean how do you parse/create it, there are many mature libraries for JSON handling.
Perhaps a specific situation or use case would assist in pinning down your question, if the above is not the answer you were looking for.
Upvotes: 0