Loona Automation logoLoona Developer Tools
Home › Code Generators

JSON to JSON Schema Generator

In short: paste a JSON sample and get a draft JSON Schema describing it — inferred types, nested properties, array items and required keys.
🔒 Private by design: everything runs in your browser on this device. Your input is never uploaded to a server.

Example

Input:

{"name": "Ali", "age": 30}

Output:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "age": {
      "type": "integer"
    }
  },
  "required": [
    "name",
    "age"
  ]
}

About this converter

A schema inferred from one sample is a starting point with known blind spots, and this generator is honest about them: every key present becomes required (a second sample might prove some optional), numbers become integer or number by the sample's shape, and no constraints (minLength, pattern, enum) can be inferred from a single value. What you get is the structural skeleton — types, nesting, array item shapes — which is 90% of the typing when documenting an API or setting up validation, ready for you to relax required lists and add the constraints only a human knows.

Frequently Asked Questions

Why is every property required?

Inference from one sample cannot know a key is optional. Feed an array of varied samples to tools that merge, or trim the required list by hand.

Which draft is generated?

JSON Schema 2020-12, the current release; the structure is also compatible with draft-07 consumers for these basic keywords.

Related Developer Tools

Embed this tool on your website — free

Add this tool to your own website or blog — it is completely free, needs no sign-up, and always shows the latest version. Copy the code below and paste it into your page where you want the tool to appear. Keeping the small “Powered by Loona Automation” credit line under the embed helps keep this tool free — but you are free to style or remove it; the tool works either way.