Tool to generate JSON schema from JSON data [closed]

Solution 1:

Summarising the other answers, here are the JSON schema generators proposed so far:

Online:

  • https://www.liquid-technologies.com/online-json-to-schema-converter (1 input)
  • http://www.jsonschema.net (1 input)
  • https://easy-json-schema.github.io (1 input)

Python:

  • https://github.com/gonvaled/jskemator (1 input but allows iteration)
  • https://github.com/perenecabuto/json_schema_generator (1 input)
  • https://github.com/rnd0101/json_schema_inferencer (1 input I think)
  • https://pypi.python.org/pypi/genson/ (multiple inputs)
  • https://pypi.python.org/pypi/skinfer (multiple inputs)

NodeJS:

  • https://github.com/Nijikokun/generate-schema (multiple inputs (pass object array))
  • https://github.com/easy-json-schema/easy-json-schema (1 input)
  • https://github.com/aspecto-io/genson-js (multiple inputs)

Ruby:

  • https://github.com/maxlinc/json-schema-generator (1 input)

Solution 2:

You might be looking for this:

http://www.jsonschema.net

It is an online tool that can automatically generate JSON schema from JSON string. And you can edit the schema easily.

Solution 3:

GenSON (PyPI | Github) is a JSON Schema generator that can generate a single schema from multiple objects. You can also merge schemas with it. It is written in Python and comes with a CLI tool.

(Full disclosure: I'm the author.)

Solution 4:

Seeing that this question is getting quite some upvotes, I add new information (I am not sure if this is new, but I couldn't find it at the time)

  • The home of JSON Schema
  • An implementation of JSON Schema validation for Python
  • Related hacker news discussion
  • A json schema generator in python, which is what I was looking for.

Solution 5:

After several months, the best answer I have is my simple tool. It is raw but functional.

What I want is something similar to this. The JSON data can provide a skeleton for the JSON schema. I have not implemented it yet, but it should be possible to give an existing JSON schema as basis, so that the existing JSON schema plus JSON data can generate an updated JSON schema. If no such schema is given as input, completely default values are taken.

This would be very useful in iterative development: the first time the tool is run, the JSON schema is dummy, but it can be refined automatically according to the evolution of the data.