Python library that prints a Python dict
as PlantUML code or as an inline picture in a Jupyter Notebook.
Heavily inspired by json-to-plantuml by meteorbites and IPlantUML by John B Nelson.
Install plantuml
, for example with brew install plantuml
. The location should be /usr/local/bin/plantuml
. This is hardcoded for now, so if you need to change it, please install from source.
pip install dict2uml
Optionally install jupyter
to generate these pictures directly in a notebook.
pip install jupyter
This can be used either at command line or in a notebook. You can generate an SVG or print the code that generated the diagram.
import dict2uml
d = {"beers": ["Heineken","Budweiser","Guinness"]}
To print the class diagram of the dict d
in Jupyter, do
dict2uml.dict2svg(d)
Print the source code for the PlantUML class diagram.
print(dict2uml.dict2plantuml(d))
cat example.json | python dict2uml.py | plantuml -pipe | open -a Preview.app -f
- Wikipedia contributors, "JSON," Wikipedia, The Free Encyclopedia, https://en.wikipedia.org/w/index.php?title=JSON&oldid=806502500 (accessed November 3, 2017).
- json-to-plantuml by meteorbites
- IPlantUML by John B Nelson.
- PlantUML