json-to-schema

0.0.2 • Public • Published

JSON TO JSON-Schema

给定数据转化为json-schema定义.

convert raw JSON to json-schema.

效果请看Demo

安装

TBower

tbower install json-to-schema --save

NPM

npm install json-to-schema --save

使用

var JSONToSchema = require( 'json-to-schema' );
\\ 如果在浏览器中又不借助包管理,则window.JSONToSchema
 
console.log( JSONToSchema( {
    name: 'lalal',
    age: 12
});
 
/**
 * output:
 {
    type: 'object',
    description: '',
    properties: {
        name: {
            type: 'string',
            description: ''
        },
        age: {
            type: 'integer',
            description: ''
        }
    }
 }
 */

Package Sidebar

Install

npm i json-to-schema

Weekly Downloads

232

Version

0.0.2

License

MIT

Last publish

Collaborators

  • abc-team