Skip to content
Advertisement

modifiy data of json file

How can I modify the values of json file using python? so my json file is:

JavaScript

so this is my json and I want to replace the values like: roll no= 211 and travel=”no” ,singing=”no”

I have tried:

JavaScript

I have tried this but the only change I’m able to doing is roll no,but I’m unable to change the hobbies values expected output:

JavaScript

Advertisement

Answer

Here is how i have updated hobbies for new roll number

JavaScript

Output:

JavaScript
Advertisement