I'm trying to parse a json file into a python dict (to make it copy-ready for Redshift).
My intended output format is:
{col1:val1, col2:val2,..}
{col1:val1, col2:val2,..}
The current format of the file is:
{"val0": {"col1":"val1", "col2":"val2",..},
"val0": {"col1":"val1", "col2":"val2",..},..}
Where "val0" is a date field (only value, no column name) that I don't need in my output.
How do I convert the latter format to the former? I've tried going through documentation for the json module (as well as a few other StackOverflow answers), but nothing seems to click. Any help is appreciated. Thanks!
f = open("<PATH>/jsoninput.json","r").read() import json parsed_json = json.loads(f) print parsed_jsonI just get the same format as before. @SuperSaiyan: The order of lines doesn't particularly matter. Only that the order within each line stays consistent (I'll be loading the output file into redshift tables daily).