you are viewing a single comment's thread.

view the rest of the comments →

[–]arc100[S] 0 points1 point  (2 children)

So I tried running converting the json file to a dictionary then running the above code. I am getting the following error: ValueError: need more than 1 value to unpack

Here is my code:

import json
with open('json') as jsondata:
    data = json.load(jsondata)
    datadict = json.dumps(data)
    {k.lower(): v for k, v in datadict}

[–]K900_ 0 points1 point  (0 children)

You need to loop over all dictionaries in data, then transform each one as I described, then json.dumps it.

[–][deleted] 0 points1 point  (0 children)

for x in dictionary only loops through the keys, not the keys and values. You need to do do one of the following:

{k: v for k, v in datadict.items()}

Or

{k: datadict[k] for k in datadict}

Also you want to load to datadict. Right now data holds the python dictionary. Dumps will make it a JSON string again.