I need to render JSON data in my JSPs for some AJAX requests. I'd like to know what's the best way to do it in terms of easy to use and stability.
+1
A:
Assuming you want to generate the JSON from one or more Java objects, the following is a fairly straightforward approach:
- Set the Java object(s) as attributes in request/session scope
- Convert the objects to JSON using a tag library such as http://json-taglib.sourceforge.net/index.html
Don
2008-11-10 19:58:25
A:
I'm assuming you have checked out json.org already...
I recently switched from json-lib to XStream:
Definitely much easier. Just a few lines of code and you are done. Note, it started as an XML serializer, deserializer. It now supports JSON ouput.
Mike
2008-11-10 20:40:11