JSON Schema Generator

JSON Data इनपुट

1

JSON Schema आउटपुट

सेटिंग्स
Input change होने पर auto-generateEnabled

JSON Schema Generate करें

Left side में अपना JSON data दर्ज करें ताकि corresponding JSON Schema automatic generate हो सके

Nested objects और arrays support करता है

Data types auto-detect करता है

Validation rules generate करता है

JSON से JSON Schema कैसे generate करें – step-by-step guide

Validation, documentation और API contracts के लिए अपने JSON sample data से schema definitions बनाने हेतु इस online JSON Schema generator का उपयोग करें।

  1. स्टेप 1 – अपना JSON sample दें

    • Left editor में एक representative JSON object या array paste करें।
    • Real production data उपयोग करें ताकि schema सही data structure reflect करे।
    • सभी possible field values और nested structures के उदाहरण शामिल करें।
  2. स्टेप 2 – Generated schema review करें

    • Right side पर schema inferred types, required fields और structure definitions के साथ दिखाई देगा।
    • Check करें कि array items, nested objects और property types आपकी अपेक्षाओं से match कर रहे हैं।
    • Verify करें कि optional vs required fields सही पहचाने गए हैं।
  3. स्टेप 3 – Schema customize करें (optional)

    • Generated schema copy करें और custom validation rules, descriptions या constraints जोड़ें।
    • ज़रूरत के अनुसार enum values, minLength/maxLength, या pattern regex जोड़ें।
    • Union types के लिए oneOf या anyOf define करें।
  4. स्टेप 4 – Schema उपयोग करें

    • Schema को download या copy करके JSON validators, API documentation tools या code generators के साथ उपयोग करें।
    • Ajv (JavaScript), jsonschema (Python) जैसी validation libraries के साथ integrate करें।
    • Schema को OpenAPI/Swagger specs में reference करें या type-safe code generate करने के लिए उपयोग करें।

Schema generation के लिए quick tips

  • Production में उपयोग करने से पहले generated schema को JSON validator या runtime library से validate जरूर करें।
  • Realistic sample data उपयोग करें ताकि generator सही types और required properties infer कर सके।
  • Environments के बीच drift से बचने के लिए प्रति payload (जैसे API request/response) एक canonical schema रखें।

Schema keyword support note

यदि आप advanced keywords जैसे $ref, anyOf, oneOf, या allOf जोड़ते हैं, तो full JSON Schema validator (उदाहरण: Ajv) से validate करें और mock data generate करने से पहले schema dereference करने पर विचार करें।

उदाहरण: JSON से JSON Schema
// JSON input
{
  "id": 1,
  "name": "Maeve Winters",
  "email": "[email protected]",
  "active": true,
  "tags": ["developer", "backend"]
}

// Generated JSON Schema (simplified)
{
  "type": "object",
  "properties": {
    "id": { "type": "number" },
    "name": { "type": "string" },
    "email": { "type": "string" },
    "active": { "type": "boolean" },
    "tags": {
      "type": "array",
      "items": { "type": "string" }
    }
  },
  "required": ["id", "name", "email", "active", "tags"]
}

Related JSON Schema & validation tools

Schema generator के साथ इन tools का उपयोग करके JSON data validate करें, document करें और workflows बेहतर बनाएं।

अक्सर पूछे जाने वाले सवाल

JSON Schema क्या है?

JSON Schema एक vocabulary है जो आपको JSON documents को annotate और validate करने देता है। यह बताता है कि किसी application के लिए कौन-सा JSON data आवश्यक है और उसे कैसे उपयोग करना है—एक contract की तरह।

मैं अपने JSON data से schema कैसे generate करूँ?

बस अपना JSON data input editor में paste करें। Schema आपके data structure के आधार पर automatic generate होगा—data types, required fields और patterns सहित।

Generated schema में क्या-क्या शामिल होता है?

Generated schema में data types, required properties, property descriptions, array item definitions, object structure और आपके JSON data patterns के आधार पर validation constraints शामिल होते हैं।

क्या मैं generated schema customize कर सकता/सकती हूँ?

हाँ! Generation के बाद आप schema copy करके अपनी जरूरत के अनुसार अतिरिक्त constraints, descriptions या validation rules जोड़ सकते/सकती हैं।

JSON Schema Generator | JSONSwiss