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

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -