json-to-dot

1.1.0 • Public • Published

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

Package Sidebar

Install

npm i json-to-dot

Weekly Downloads

14

Version

1.1.0

License

MIT

Unpacked Size

3.5 kB

Total Files

5

Last publish

Collaborators

  • ristostevcev