Python · Errors and files

json module

Serialises Python values to JSON and back. Use indent=2 for readable output.

Syntax
json.dumps / json.loads

Example

Open in the lab

More in this group

assert csv module Custom exception else and finally pathlib.Path raise try / except with

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course