Q:

Write a Python program to create a new JSON file from an existing JSON file

0

Write a Python program to create a new JSON file from an existing JSON file

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import json

with open('states.json') as f:
  state_data= json.load(f)

for state in state_data['states']:
  del state['area_codes']

with open('new_states.json', 'w') as f:
  json.dump(state_data, f, indent=2)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now