Show JSON in a notebookΒΆ

Links: notebook, html, PDF, python, slides, GitHub

Displays JSON in a notebook.

Inspired from Pretty JSON Formatting in IPython Notebook. We use the trick described just above. The only addition is the use of an external library renderjson. The code is here : json_helper.py.

from jyquickhelper import JSONJS
JSONJS(dict(name="xavier", city="Paris"), only_html=True, show_to_level=3)
import requests
data_json = requests.get("http://api.worldbank.org/countries?incomeLevel=LMC&format=json").json()
JSONJS(data_json)