Nighttime Peanut Migrations
Have ideas to improve npm?Join in the discussion! »

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: ''
        }
    }
 }
 */

Install

npm i json-to-schema

DownloadsWeekly Downloads

2

Version

0.0.2

License

MIT

Last publish

Collaborators

  • avatar