json-to-plantuml

0.0.9 • Public • Published

json-to-plantuml

Transforms JSON to Plant UML to help visualize your JSON data.

Example JSON data

{
    "name": "Product",
    "properties": {
        "id": {
            "type": "number",
            "description": "Product identifier",
            "required": true
        },
        "name": {
            "description": "Name of the product",
            "type": "string",
            "required": true
        },
        "price": {
            "type": "number",
            "minimum": 0,
            "required": true
        },
        "tags": {
            "type": "array",
            "items": {
                "type": "string"
            }
        }
    }
}
 

Example Plant UML outut

alt text

As CMD line tool

Install

$ npm install -g json-to-plantuml

Run

echo '{"foo": "bar"}' | json-to-plantuml
$ json-to-plantuml -f .\data\albumdata.json

Piping to PlantUML to generate image

echo '{"foo": "bar"}' | json-to-plantuml | java -jar plantuml.jar -pipe > foobar.png
$ json-to-plantuml -f .\data\albumdata.json | java -jar plantuml.jar -pipe > albumdata.png

gif

Install Dependencies to generate image

Java, Plant UML, GraphViz

Known to work with PlantUML following versions

plantuml-jar-lgpl-8048

plantuml-jar-lgpl-8049

As project dependency

Install

$ npm install --save json-to-plantuml

Code

var jsonToPlantUml = require('json-to-plantuml');
 
jsonToPlantUml('{"foo":"bar"}')
    .then(console.log)
    .catch(console.log);

Output

@startuml
class "root" as root {
    .. Properties ..
    foo: bar
}
@enduml

Package Sidebar

Install

npm i json-to-plantuml

Weekly Downloads

15

Version

0.0.9

License

ISC

Last publish

Collaborators

  • meteorbites