Skip to content

pirosikick/node-schemize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Generates JSON Schema from JSON

Resources

Stars

Watchers

Forks

Packages

No packages published