What is the best practice for providing JSON data in JSP?

I need to display JSON data in my JSP for some AJAX requests. I would like to know what is the best way to do this in terms of easy to use and stability.

+3
source share
2 answers

I assume you already checked json.org ...

I recently switched from json-lib to XStream:

http://x-stream.imtqy.com/

Definitely much easier. Just a few lines of code and you're done. Note that it started as an XML serializer, a deserializer. Now it supports JSON output.

+1
source

Assuming you want to generate JSON from one or more Java objects, the following is a fairly simple approach:

+3

Source: https://habr.com/ru/post/1699370/


All Articles