schemize

1.1.0 • Public • Published

npm version david Build Status

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
{
  "type""object",
  "properties"{
    "key"{
      "type""string"
    }
  }
}

Programmatic API

var schemize = require('schemize');
 
var json = {
  key: "value"
};
 
console.log(schemize(json));

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i schemize

Weekly Downloads

0

Version

1.1.0

License

MIT

Last publish

Collaborators

  • pirosikick