https://github.com/konsumer/json2x
Use your JSON data to generate models for various things
https://github.com/konsumer/json2x
Last synced: 11 months ago
JSON representation
Use your JSON data to generate models for various things
- Host: GitHub
- URL: https://github.com/konsumer/json2x
- Owner: konsumer
- Created: 2018-04-13T01:57:56.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-08-29T04:26:45.000Z (almost 7 years ago)
- Last Synced: 2025-07-20T20:03:39.393Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 455 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# json2x
[](https://travis-ci.org/konsumer/json2x) [](https://greenkeeper.io/)
Use your JSON data to generate models for various things.
I often have a bunch of JSON mock that I need to get models for some other system from. This is a framework to generate all of the following:
* GraphQL types
* protobuf messages
* JSONSchema
If you don't want the actual model of the children, based on your data, you can use other things like [graphql-type-json](https://github.com/taion/graphql-type-json) or whatever. The idea is here is that you actually want to define the model of your data, and it's reasonably structured.
It looks at as many examples as you give it and learns from multiple records, so if you have lots of mock, use it.
## installation
If you want to actually install it use this:
```
npm i -g json2x
```
You can also just do this, to run it without installing it globally:
```
npx json2x
```
## usage
```
json2x
Commands:
json2x graphql Generate GraphQL types from your data
json2x jsonschema Generate JSONSchema from your data
json2x proto Generate protobuf message-definitions from your data
Options:
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
Examples:
json2x graphql -h Get some help with the graphql command
json2x jsonschema -h Get some help with the jsonschema command
json2x proto -h Get some help with the proto command
```