To get a list format similar sets of dictionaries list format, but a closer look and found a list of sets of strings, the string is the dictionary, but, still incomplete dictionary of dictionaries, there Key, there is Value, but Key without the quotes, and , there is a big push null character: describes too strenuous, on the map it:
This format json is powerless, given:
import json for i in l: json.loads(i) # 报错: json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 2 column 29 (char 30)
Python library so much, it is impossible not to deal with this method format, and sure enough: demjson perfect solution to this problem:
On the code:
import demjson for i in l: dic = demjson.decode(i) print(dic)
result:
Those tiresome to automatically remove whitespace, the perfect place ~ ~