Infers a JSON Schema (draft-07) from a JSON sample.
JSON to JSON Schema infers a draft-07 JSON Schema from a sample JSON document. Paste a representative object or array and it generates a schema with inferred types, object properties, and required fields. It is handy when you want a starting point for validation or API documentation without writing the schema by hand.
No. The conversion runs entirely in your browser using JSON.parse and a local inference function. Nothing is uploaded, and your data never leaves your device.
It always emits draft-07, setting $schema to http://json-schema.org/draft-07/schema#.
The schema infers the item type from the first element of an array only, so mixed-type arrays are not merged. An empty array produces just {"type": "array"} with no items.
Whole numbers like 42 are typed as integer, while values with a fractional part like 3.14 are typed as number. This is based on the sample value, not on any declared type.
Yes. Every key present in the sample object is added to the required array. The tool does not detect optional fields, so remove any that should be optional after generating the schema.
The input is parsed with JSON.parse, so malformed JSON will raise a parse error instead of producing a schema. Make sure the input is valid JSON first.