Working with JSONP in my GWT application has presented some challenges. When the server sends a json string, I am able to retrieve it in the form of a JavaScriptObject on the client side.
The issue arises when my json data contains complex structures, using maps and nested keys. Extracting data becomes cumbersome as I would need to write numerous functions for each key, resulting in complicated code and map filling.
I am exploring a few potential solutions:
Encoding and sending entire json strings as regular strings to the client (within a simple json string value). However, I am concerned that the encoded strings may be significantly longer than the original ones, potentially exceeding the 2k character limit.
Converting a JavaScriptObject back into a pure string (similar to the one sent from the server).
Once I have a pure string, I plan to parse it using json parsers/methods into more manageable structures.
My questions are:
1) How can I convert a JavaScriptObject object back into a pure/original json string?
2) Any suggestions for alternative solutions?
Thank you in advance.