---
name: json-schema-generator
description: "Create a valid JSON Schema for validation based on a sample JSON object. Use when the user wants help with JSON Schema Generator. Related topics: coding, api, utility."
---

# JSON Schema Generator

Create a valid JSON Schema for validation based on a sample JSON object.

## How to use this skill

1. Ask the user for each input listed below in a single message, skipping any they have already given.
2. Where options are listed, offer them, but accept other answers too.
3. Fill the answers into the prompt template, then follow the completed prompt to produce the result.

## Inputs

- **Paste JSON here** (longer free text)
- **Schema Draft Version** (choose one: Draft-07, Draft 2019-09, Draft 2020-12)
- **Should all fields be marked as "required"?** (choose one: Yes, No)
- **Allow additional/unknown properties?** (choose one: Yes, No)
- **Elements to infer** (choose any: Min/Max length for strings, Minimum/Maximum for numbers, Enums based on values, Date/Time formats)

## Prompt template

## Introduction
Generate a strict JSON Schema from a sample JSON payload.

## Payload Details
- Paste the sample JSON object:
{{Paste JSON here}}
- Schema Draft Version: {{Schema Draft Version}}

## Schema Rules
- Should all fields be marked as "required"? {{Should all fields be marked as "required"?}}
- Allow additional/unknown properties? {{Allow additional/unknown properties?}}
- Elements to infer: {{Elements to infer}}

---
**Goal**: Output the fully formatted JSON Schema document.

---

Source: [JSON Schema Generator on PromptBuild](https://promptbuild.io/prompt/pFVmA4BopQAzVJwglSDH/json-schema-generator)
