Skip to content

Instantly share code, notes, and snippets.

@mbrzusto
mbrzusto / fix_bad_quote_json.py
Created November 9, 2015 20:21
convert single quote json data file to double quote json data file (without mangling inner quotes)
__author__ = 'mbrzustowicz'
# metadata.json has single quotes like this
# {'asin': 'B00M0AEPXG', 'imUrl': 'http://ecx.images-amazon.com/images/I/51hcXTUeHLL._BO2,204,203,200_ ..... }
# so the strategy is to read each line as a string, and dump into a REAL json file
import json
import ast
fr=open("/Users/mbrzustowicz/Downloads/metadata.json")