python - Transform invalid nested json to valid one and change to list -
under link :
http://dev1.gecoloco.com/rte/done_json.php have json-like object, i'm operating on. cannot load simplejson, because wrongly formatted. , code fails :
conn = httplib.httpconnection("dev1.gecoloco.com") conn.request("get", "/rte/done_json.php") r = conn.getresponse() data = r.read() logging.debug(data) json = simplejson.loads(data)
as result i'd list of dictionaries.
first question how load proper json? read string , replace quotes or different ?
second question how transform formatted json list of dictionaries ? (do need json easily?) ?
help.
the nice thing json it's so, close python literal syntax. use ast.literal_eval()
parse it.
Comments
Post a Comment