~/json-to-types

JSON to JSON Schema generator

Convert any JSON sample to a JSON Schema (draft-06). Cross-language contract for validation, code generation, and documentation tooling.

# context

JSON Schema is the lingua franca for describing JSON shape across languages. Once you have a schema, every language with a generator (this tool, quicktype CLI, openapi-generator, json-schema-to-typescript, etc) can derive types in its native style. This is the path to take when you want one source of truth for an API contract.

JSON input

{
  "id": 1,
  "name": "Ada Lovelace",
  "email": "[email protected]",
  "active": true,
  "roles": ["admin", "engineer"],
  "createdAt": "2026-05-14T00:00:00Z"
}

Output preview

{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "$ref": "#/definitions/User",
    "definitions": {
        "User": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "id":        { "type": "integer" },
                "name":      { "type": "string" },
                "email":     { "type": "string", "format": "email" },
                "active":    { "type": "boolean" },
                "roles":     { "type": "array", "items": { "type": "string" } },
                "createdAt": { "type": "string", "format": "date-time" }
            },
            "required": ["id", "name", "email", "active", "roles", "createdAt"]
        }
    }
}

→ Open in JSON to Types generator (pre-filled)

# notes

# other targets