DevOnlineTools

JSON to AI Structured Schema

Convert sample JSON objects into validated JSON Schema definitions compatible with OpenAI Structured Outputs, Claude Function Calling, and Gemini schemas.

devonlinetools://ai/json-schema-to-ai
⌘ + EnterRun / Format
Shortcuts Active
Generated AI Code & Schema
// OpenAI SDK Structured Output Request
import OpenAI from "openai";
const openai = new OpenAI();

const response = await openai.chat.completions.create({
  "model": "gpt-4o",
  "messages": [
    {
      "role": "user",
      "content": "Extract details from user text"
    }
  ],
  "response_format": {
    "type": "json_schema",
    "json_schema": {
      "name": "user_extracted_data",
      "strict": true,
      "schema": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "age": {
            "type": "integer"
          },
          "email": {
            "type": "string"
          },
          "isSubscribed": {
            "type": "boolean"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "name",
          "age",
          "email",
          "isSubscribed",
          "tags"
        ],
        "additionalProperties": false
      }
    }
  }
});