Install
Basic usage
Given a sample JSON file:$ref + definitions structure. The type name (Sample) is derived from the filename. Unlike Genson, Quicktype sets additionalProperties: false by default.
Multiple samples
Pass multiple samples to improve inference. Quicktype merges them and detects optional fields: a field missing from some samples becomes non-required:phone is correctly detected as optional since it only appears in one sample. When multiple source files are provided, the type is named TopLevel instead of being derived from a filename.
Nested objects
Quicktype extracts nested objects into separate definitions and references them via$ref:
address is PascalCased to Address for the definition.
Arrays
Quicktype infers item types from array contents:minItems or maxItems; add those manually. See Bounded Arrays.
Arrays of objects
When arrays contain objects, Quicktype extracts the item schema into a separate definition, singularizing the field name:contacts produces a definition named Contact (singular).
Type inference across samples
When multiple samples expose different field sets, Quicktype correctly distinguishes required from optional and infersinteger vs number:
id (whole numbers) is typed as integer while score (decimal) is typed as number. score is optional since it only appears in one sample.
Limitations
Quicktype infers structure and types but does not add semantic constraints. The generated schema will not include:enumvaluesminLength,maxLength, orpatternfor stringsminItems,maxItemsfor arraysdescriptionon fields or the schema
$ref + definitions rather than the more modern $defs.
The output is a starting point. Tighten it by adding constraints manually or follow Improve your schema.