Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
341 views
in Technique[技术] by (71.8m points)

python - JSON styling in Jupyter Lab and GitHub

Jupyter Notebook (and Jupyter Lab) comes with a very convenient and interactive JSON formatter. It's very useful for letting a user look through a very deep dictionary without flooding the output cell with a huge amount of information. Normally, if we have a dictionary called my_dict, you can print its contents neatly to the output cell by:

from IPython.display import display, JSON
display(JSON(my_dict))

Which will give you something that looks like this: enter image description here

The user can then interact with it to open/close different portions.

The problem is that if you take this approach, it doesn't seem to render properly on GitHub's web browser. In its place, you'll get:

<IPython.core.display.JSON object>

Any way I could have a nice JSON viewer like this that works on both a local JupyterLab instance, and on GitHub's website? Or am I forced to flood the output cell with hundreds of lines of JSON?

question from:https://stackoverflow.com/questions/65946583/json-styling-in-jupyter-lab-and-github

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...