Coding
json-schema
validation
api
JSON Schema Generator
Generate JSON Schema definitions from example JSON objects, descriptions, or TypeScript types.
The Prompt
(2 messages)System
You are a JSON Schema expert. Generate valid JSON Schema (draft 2020-12) from the provided input. Rules: - Infer types, required fields, and constraints from the input - Add descriptive "description" fields for every property - Use appropriate string formats (email, uri, date-time, uuid) when the data suggests it - Add sensible constraints: minLength, maxLength, minimum, maximum, pattern where applicable - Mark fields as required if they appear consistently or are clearly essential - If generating from an example, note any assumptions about optionality in the output
User
Generate a JSON Schema from the following: Input type: {{input_type}} Input: {{input}}
Variables
Fill in these inputs to customize your output:
{{input_type}}Example: example JSON object
{{input}}Example: { "id": "usr_abc123", "email": "alex@example.com", "name": "Alex Chen", "role": "admin", "created_at": "2026-01-15T10:30:00Z", "settings": { "theme": "dark", "notifications": true, "language": "en" } }
Example Output
Here's what this prompt generates with the sample inputs:
Sample outputgpt-4.1
{
"schema": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "User",
"properties": {
"id": {
"type": "string",
"description": "Unique user identifier with 'usr_' prefix.",
"pattern": "^usr_[a-zA-Z0-9]+$"
},
"email": {
"type": "string",
"format": "email",
"description": "User's email address."
},
"name": {
"type": "string",
"description": "User's display name.",
"minLength": 1,
"maxLength": 255
},
"role": {
"type": "string",
"enum": ["admin", "member", "viewer"],
"description": "User's role in the workspace."
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp of when the user was created."
},
"settings": {
"type": "object",
"description": "User preferences.",
"properties": {
"theme": {
"type": "string",
"enum": ["light", "dark", "system"],
"description": "UI theme preference."
},
"notifications": {
"type": "boolean",
"description": "Whether email notifications are enabled."
},
"language": {
"type": "string",
"description": "Preferred language as ISO 639-1 code.",
"pattern": "^[a-z]{2}$"
}
},
"required": ["theme", "notifications", "language"]
}
},
"required": ["id", "email", "name", "role", "created_at"]
},
"assumptions": [
"role enum values inferred as admin/member/viewer — adjust based on your actual roles",
"theme enum includes 'system' as a common default — verify against your options",
"All top-level fields except settings are marked as required since they appear essential"
]
}Configuration
Optimized settings included when you add this prompt. You can adjust them later.
Provider
OPENAI
Model
gpt-4.1
Temperature
0.1
Output
Structured JSON
Ready to use this prompt?
Add it to your workspace, customize the inputs, and generate your own results.
Use this prompt — freeMore prompts
Code Reviewer
Coding
Get detailed code reviews with prioritized issues, bug detection, security checks, and actionable fix suggestions.
code-review
bugs
+2
Claude Sonnet 4.5SQL Query Generator
Coding
Convert natural language questions into SQL queries. Supports PostgreSQL, MySQL, SQLite, and SQL Server.
sql
database
+2
GPT-4.1Unit Test Generator
Coding
Generate comprehensive unit tests for your code with edge cases, mocking strategies, and clear assertions.
testing
unit-tests
+2
Claude Sonnet 4.5