I have a significant amount of data to post, and it needs to be minimized for performance reasons.
Initially, my data consists of JavaScript objects which I then convert to JSON format before sending it via POST request.
The issue is that my data includes numerous objects (lists []) and dictionaries ({}) along with short text enclosed in quotes ("") by the JSON formatting.
Subsequently, when the data is sent, all brackets ([{), curly braces ({}), and quotes ("") are URI encoded by the browser. This results in a significant increase in string length.
For example, running the following comparison shows that the URI encoded string is 50% larger:
alert(JSON.stringify(myStuff).length);
alert(encodeURI(JSON.stringify(myStuff)).length);
This expansion can become quite problematic, especially with large initial strings. It seems that while JSON is a standard format, this downside affects efficiency. Are there any alternatives to using JSON in this case? Or am I overlooking something here? Is URI encoding always necessary for data transmission?