0

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.

1
  • Duplicate of JSON, Servlet, JSP. If you can't find your previously asked questions, click at the nickname (user448402) at top bar. Commented Oct 29, 2010 at 17:33

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

"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.

1 Comment

How do I pass parameters from ServletOne to ServletTwo using a HTTP POST through URL intead of using HTTP GET in the servlet? For example: localhost/ServletOne?username=test If the above link is accessed, in ServletTwo, username test will be displayed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.