Answer the question
In order to leave comments, you need to log in
How to parse json in python?
Good day, there was a need to parse a json file and store its contents in MongoDB using mongo_engine. It will be necessary to do several stages of saving, since the final model has two reference fields, that is, it is necessary to extract data for intermediate saving / processing.
Are there any libraries/others that make this operation easier?
Answer the question
In order to leave comments, you need to log in
Parsing JSON in python is convenient out of the box.
import json
data = {"1":"one", "2":"two"} # python словарь
json_data = json.dumps(data) # упаковываем
parsed_json = json.loads(json_data) #распаковываем
print data == parsed_json # True
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question