Python todo notebook (1/6): brief and JSON
Why JSON fits a console todo notebook, how taches.json stores an id, a title and a done flag, and the five menu actions the later chapters build.
Getting started
Home Assistant
Buying
Why JSON fits a console todo notebook, how taches.json stores an id, a title and a done flag, and the five menu actions the later chapters build.


AI-generated illustration
Some links on this page are affiliate links. The button opens Amazon so you can check today’s price.
A todo notebook in the console is a program that adds, lists, checks off and deletes tasks, and saves them to disk so nothing disappears when you close the terminal. JSON is readable by a person, widely used, and Python already supports it through the built-in json module.
The wider path is the Python course.
File taches.json:
{
"prochain_id": 3,
"taches": [
{"id": 1, "titre": "Finish the hangman", "fait": false},
{"id": 2, "titre": "Groceries", "fait": true}
]
}
prochain_id: an integer used to give each new task a unique id.taches: a list of objects (Python dictionaries) with at least id, titre and fait.You can add date_creation or priorite later, as an extension.
[ ] / [x].id instead of only a line number?Part 2 — Load and save the file with the json module.
A book search for Python, data and JSON: Check today’s price on Amazon.
Was this page helpful?
Thank you!
What should we improve?
Torn between two models or stuck on a build? Drop us a line and we will get back to you by email.
Cookies and analytics
We use Google Analytics 4 to understand how the site is used (page views, navigation). It is only switched on if you accept. Declining does not stop you using the site. More: cookie settings and privacy policy (in French).