![]() |
looking 4 py code: json compactor - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html) +--- Forum: Bar (https://python-forum.io/forum-27.html) +--- Thread: looking 4 py code: json compactor (/thread-1395.html) |
looking 4 py code: json compactor - Skaperen - Dec-30-2016 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. RE: looking 4 py code: json compactor - wavic - Dec-30-2016 Have a look at this: http://msgpack.org But compressing json should be easy. Just removing white spaces and '\n'. RE: looking 4 py code: json compactor - Skaperen - Dec-30-2016 yeah, it should be easy. i just need to make sure not too much is deleted that would make it be invalid. RE: looking 4 py code: json compactor - wavic - Dec-30-2016 It's a JS syntax and the spaces doesn't matter there. I think ![]() |