node-schemize
Generates JSON Schema from JSON. This package was inspired by this gem package.
Installation
$ npm install schemize # if you want to use CLI, please install as global package. $ npm install -g schemize
CLI
$ schemize --help Usage: schemize [options] Generates JSON schema from JSON Options: -h, --help output usage information -V, --version output the version number -i, --input <path> Input file path --pretty [integer|"tab"] Prettify output JSON
Example:
$ echo '{ "key": "value" }' > example.json # Input from stdin $ cat example.json | schemize{"type":"object","properties":{"key":{"type":"string"}}} # Input from file $ schemize -i example.json{"type":"object","properties":{"key":{"type":"string"}}} # Prettify output JSON format $ schemize -i example.json --pretty
Programmatic API
var schemize = ; var json = key: "value"; console;