(Jun-11-2018, 08:44 AM)buran Wrote:(Jun-11-2018, 08:18 AM)volcano63 Wrote: This simple code produces the same result (but nobody listens Doh )
Python Code: (Double-click to select all)
1
json.loads(json.dumps(data).replace('null', '"vacio"'))
(Jun-10-2018, 06:50 PM)buran Wrote: what you do is to read json, then immediately dump it back as string. So then why read it as json at all? just read the file as text and replace "null" if you are going to do thisthe simplest code wouldn't need to import/use json at all
My point was that the approach initially taken by OP would have worked with a slight adjustment. Recursion is the proper way - but solution-like it is simpler with
json
(not everyone is proficient with recursions - it took me a Scala course to grok it better).
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.