Crunching json with python -
Now I need to find a way to crush down Jason in a row to echo: eg. {"Node 1": {"node 1": {"attr0": "foo", "attr1": "foo bar", "attr2": "Price with long position "}"}
would like to move down one line:
{"node0": {"node1": {"attr0": " "Foo", "attr1": "foo bar", "ATTR2": "prolonged price with spaces"}}}
to remove the trivial white spaces and that Prices are within the protection. Is there a library to do this in Python?
Edit Thanks to both Drdaeman and Eli CourtRight for super-quick response!
& gt; & Gt; & Gt; Import json & gt; & Gt; & Gt; Json.dumps (json.loads ("" ... {"node0": {... "node1": {... "attr0": "foo", ... "attr1": "foo bar", ... "attr2": "value with long position" ...} ...}} ... ... "" ")) '{" node0 ": {" node1 ": {" attr2 ": "Long spaces with value", "attr0": "foo", "attr1": "foo bar"}}} '
Comments
Post a Comment