Python Forum

Full Version: looking 4 py code: json compactor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am looking for (will eventually code it if not found) code to take a string in JSON format so the result is th shortest possible string with the same contents but still valid JSON.  might this be possible by using the json module decoder and re-encode it with appropriate options/flags?  it doesn't need to look pretty.
Have a look at this: http://msgpack.org

But compressing json should be easy. Just removing white spaces and '\n'.
yeah, it should be easy. i just need to make sure not too much is deleted that would make it be invalid.
It's a JS syntax and the spaces doesn't matter there. I think  Confused Almost all the web sites compress their JS code.