6

I am working on a very big JSON file, and I decided to use the ijson library.

Now I want to update some value in this JSON file, but I don't know how.

For example, from:

{"age": 25, "gender": "M"}

update to:

{"age": 30, "gender": "F"}

by using the ijson library.

1 Answer 1

1

Refer the examples in https://pypi.python.org/pypi/ijson/. For editing you can simply use the json library. First load/deserialize the json object then edit and finally use the dump method to update your json file.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, yes, I already thought this, but the problem is that if the file is very large (Gbs), only load the file by using json library requires a lot of time. Is there a way to address this issue?
You can use pandas dataframes or graphlab SFrame to load large json files. Also both the libraries are more stable than ijson streaming.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.