Daniele B Daniele B - 1 year ago 107
JSON Question

Python - json without whitespaces

I just realized that

adds spaces in the JSON object


{'duration': '02:55', 'name': 'flower', 'chg': 0}

how can remove the spaces in order to make the JSON more compact and save bytes to be sent via HTTP?

such as:


Answer Source
json.dumps(separators=(',', ':'))
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download