JSON Files in JSON

From the JSON cheat sheet · Python · verified Aug 2026

JSON Files

Read and write UTF-8 JSON files.

python
with open('data.json', encoding='utf-8') as file:
    data = json.load(file)
📌 load and dump operate on file objects
💡 Specify UTF-8 explicitly
🎯 Add a final newline for text-file tooling
⚠️ Validate data before overwriting files
pythonfilesencoding

Continue with JSON

Save the full cheat sheet or work through every related task.

More JSON tasks

Back to the full JSON cheat sheet