A JupyterLab and Jupyter Notebook extension for rendering JSON data
- JupyterLab ^0.17.0 and/or Notebook >=4.3.0
To render JSON-able dict or list in IPython:
from IPython.display import JSON
JSON({
"string": "string",
"array": [1, 2, 3],
"bool": True,
"object": {
"foo": "bar"
}
})
To render a fully expanded tree:
JSON({
"string": "string",
"array": [1, 2, 3],
"bool": True,
"object": {
"foo": "bar"
}
}, expanded=True)
To render a JSON file in JupyterLab, simply open it:
To install using pip:
pip install jupyterlab_json
# For JupyterLab
jupyter labextension install --py --sys-prefix jupyterlab_json
jupyter labextension enable --py --sys-prefix jupyterlab_json
# For Notebook
jupyter nbextension install --py --sys-prefix jupyterlab_json
jupyter nbextension enable --py --sys-prefix jupyterlab_json
Use the install.sh
script to build the Javascript, install the Python package, and install/enable the notebook and lab extensions:
bash install.sh --sys-prefix
Use the build.sh
script to rebuild the Javascript:
bash build.sh
Alternatively, see the README.md
in /labextension
and /nbextension
for extension-specific build instructions.
To install the Python package:
pip install -e .
To install the extension for JupyterLab:
jupyter labextension install --symlink --py --sys-prefix jupyterlab_json
jupyter labextension enable --py --sys-prefix jupyterlab_json
To install the extension for Jupyter Notebook:
jupyter nbextension install --symlink --py --sys-prefix jupyterlab_json
jupyter nbextension enable --py --sys-prefix jupyterlab_json