Python Forum
looking 4 py code: json compactor
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
looking 4 py code: json compactor
#1
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.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Have a look at this: http://msgpack.org

But compressing json should be easy. Just removing white spaces and '\n'.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
yeah, it should be easy. i just need to make sure not too much is deleted that would make it be invalid.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
It's a JS syntax and the spaces doesn't matter there. I think  Confused Almost all the web sites compress their JS code.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020