1.1.0 • Published 6 years ago

json-to-dot v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

json-to-dot

Convert a json graph to the dot format

Installation

$ npm install --save json-to-dot

Usage

It takes a single level json tree with the keys being nodes and the values being an array of strings of dependencies that should be connected:

const jsonToDot = require('json-to-dot')

jsonToDot({
  foo: ['bar', 'buzz'],
  bar: ['foo'],
  norf: ['worble', 'buzz'],
  worf: ['worble'],
  fizz: ['buzz']
})

You can also pipe a json file directly into it:

$ npm install -g json-to-dot
$ echo "{\"foo\": [\"bar\", \"baz\"], \"baz\": [\"norf\"]}" | json-to-dot

Converting dot into an image

You can convert the graph into an actual image using graphviz

$ dot -Tpng graph.dot -o graph.png

License

See LICENSE