What are the options for serializing Java objects that are returned in Ajax calls to client? On the several places in the Ajax4JSF documentation it is stated that data is serialized by default using JSON. Are there some other options?
Also, is there a way to control serialization when using JSON? Sometimes, when I need list of object where I need only 2-3 properties of each object, I am getting all the properties returned. If these properties are objects itself with their own references, it results in huge object graph which is a lot of data that I don't need. Also, if some of these objects contains some circular references, serialization would enter in infinite loop and throw OutOfMemoryError.
I solved these problems by copying original objects and returning only necessary properties, but I am wondering if there is some more elegant solution.