[英]Expecting property name enclosed in double quotes
If my json file is huge it contains to many dictionaries and lists inside the dictionary and it is enclosed with double quotes means how can i proceed that.如果我的 json 文件很大,它包含许多字典和字典中的列表,并且用双引号括起来意味着我该如何处理。 what is the deserialize?什么是反序列化? How to use the deserialize?如何使用反序列化?
Use json module.使用json模块。
If you are having json in one file then you can use:如果您在一个文件中有 json,那么您可以使用:
with open("json_data.json", "r") as data:
print(json.load(data))
OR或者
with open("json_data.json", "r") as data:
print(json.loads(data.read()))
If you are having json in any var, you can use:如果您在任何 var 中有 json,则可以使用:
jsonData = '{}'
jsonVal = json.loads(jsonData)
There is a package called json in python, which you can use to serialize and deserialize a dictionary. python中有一个叫json的包,你可以用它来序列化和反序列化一个字典。 If you want to serialize using the following:如果要使用以下内容进行序列化:
with open("huge_json_file.json", "r") as data
json_str = json.dumps(data)
If you want to de-serialize using the following:如果要使用以下方法反序列化:
with open("huge_json_file.json", "r") as data
json_dict = json.loads(data)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.