From ae6911c33b71a64e0ab17c539295a254da6d82d6 Mon Sep 17 00:00:00 2001 From: Real Python Bot <42617967+realpython-bot@users.noreply.github.com> Date: Wed, 21 Oct 2026 15:30:12 +0000 Subject: [PATCH] Sync python-json with the maintenance update of Working With JSON Data in Python - hello_frieda.py: open the output file with encoding="utf-8", as the tutorial does - hello_frieda.json, mini_frieda.json: regenerate with the tutorial's commands on Python 3.14 so the sizes match the article (283 and 257 bytes) Co-Authored-By: Claude Opus 5.5 --- python-json/hello_frieda.json | 2 +- python-json/hello_frieda.py | 2 +- python-json/mini_frieda.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/python-json/hello_frieda.json b/python-json/hello_frieda.json index a532065de6..8a663f77e9 100644 --- a/python-json/hello_frieda.json +++ b/python-json/hello_frieda.json @@ -1 +1 @@ -{"name": "Frieda", "is_dog": true, "hobbies": ["eating", "sleeping", "barking"], "age": 8, "address": {"work": null, "home": ["Berlin", "Germany"]}, "friends": [{"name": "Philipp", "hobbies": ["eating", "sleeping", "reading"]}, {"name": "Mitch", "hobbies": ["running", "snacking"]}]} +{"name": "Frieda", "is_dog": true, "hobbies": ["eating", "sleeping", "barking"], "age": 8, "address": {"work": null, "home": ["Berlin", "Germany"]}, "friends": [{"name": "Philipp", "hobbies": ["eating", "sleeping", "reading"]}, {"name": "Mitch", "hobbies": ["running", "snacking"]}]} \ No newline at end of file diff --git a/python-json/hello_frieda.py b/python-json/hello_frieda.py index 32f46bd22b..8e661fa1dd 100644 --- a/python-json/hello_frieda.py +++ b/python-json/hello_frieda.py @@ -35,5 +35,5 @@ ], } -with open("hello_frieda.json", mode="w") as write_file: +with open("hello_frieda.json", mode="w", encoding="utf-8") as write_file: json.dump(dog_data, write_file) diff --git a/python-json/mini_frieda.json b/python-json/mini_frieda.json index 86c8ff7eab..9540fe87e1 100644 --- a/python-json/mini_frieda.json +++ b/python-json/mini_frieda.json @@ -1 +1 @@ -{"name":"Frieda","is_dog":true,"hobbies":["eating","sleeping","barking"],"age":8,"address":{"work":null,"home":["Berlin","Germany"]},"friends":[{"name":"Philipp","hobbies":["eating","sleeping","reading"]},{"name":"Mitch","hobbies":["running","snacking"]}]} \ No newline at end of file +{"name":"Frieda","is_dog":true,"hobbies":["eating","sleeping","barking"],"age":8,"address":{"work":null,"home":["Berlin","Germany"]},"friends":[{"name":"Philipp","hobbies":["eating","sleeping","reading"]},{"name":"Mitch","hobbies":["running","snacking"]}]}