Understand the Jupyter Notebook file format structure
mainA Jupyter notebook is a JSON-formatted dictionary. At the highest level, it contains the following keys:
metadata(dict): Contains information about the kernel and language.nbformat(int): The major version of the notebook format.nbformat_minor(int): The minor version of the notebook format.cells(list): A list of cell dictionaries containing the notebook content.
Important Note on Multi-line Strings:
Fields like source or text may be written to disk as a single string or a list of strings. When working with notebook files directly, you must handle both types. However, programmatic APIs (like the Python or JavaScript nbformat libraries) will always re-join these into a single multi-line string when reading them into memory.
{
"metadata": {
"kernel_info": {
"name": "the name of the kernel"
},
"language_info": {
"name": "the programming language of the kernel",
"version": "the version of the language",
"codemirror_mode": "The name of the codemirror mode to use [optional]"
}
},
"nbformat": 4,
"nbformat_minor": 0,
"cells": []
}