JSON सैंपल से TypeScript इंटरफेस जनरेट करें, नेस्टेड टाइप, ऐरे और वैकल्पिक फ़ील्ड के साथ। आपके ब्राउज़र में चलता है।
JSON to TS का उपयोग कैसे करें
JSON ऑब्जेक्ट या ऐरे पेस्ट करें।
वैकल्पिक रूप से रूट इंटरफेस नाम सेट करें।
जनरेट किए गए TypeScript इंटरफेस कॉपी करें।
This is a JSON to TypeScript generator that infers a set of interfaces from an example JSON object or array, so you can paste an API response and get ready-to-use types instead of writing them by hand.
It is a big time-saver when you are consuming an API or a config file: paste a response, optionally name the root interface, and copy clean TypeScript straight into your code.
Generation runs entirely in your browser, so your data never leaves your device, which matters when the sample contains real values.
It handles real-world shapes: nested objects become their own named interfaces referenced from the parent, arrays of objects are merged into one interface, and union types are produced where values vary.
When the objects in an array do not all have the same keys, the keys missing from some elements are marked optional with a question mark, which matches how the data actually behaves and keeps the types honest.
One important point: it infers a shape from the single sample you give it, rather than enforcing a schema. If a field is sometimes null or absent in real data but not in your sample, the generated type will not know that, so use a representative example.
अक्सर पूछे जाने वाले सवाल
प्रत्येक नेस्टेड ऑब्जेक्ट अपना नामित इंटरफेस बनता है, जो अपने पेरेंट से संदर्भित होता है, इसलिए परिणाम साफ और पुन: उपयोग योग्य होता है।
ऑब्जेक्ट के ऐरे एक इंटरफेस में मर्ज होते हैं, और कुछ तत्वों से गायब की वैकल्पिक चिह्नित होती हैं। मिश्रित primitives के ऐरे union element type बनते हैं।
नहीं। टाइप पूरी तरह आपके ब्राउज़र में जनरेट होते हैं।
इस टूल को एम्बेड करें
इस टूल को अपनी वेबसाइट में जोड़ें। नीचे दिया स्निपेट कॉपी करें; यह अपने आप अपडेट रहता है।
<iframe src="https://monu.tools/embed/hi/json-to-typescript" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>संबंधित टूल
अमान्य इनपुट के लिए स्पष्ट त्रुटि संदेशों के साथ JSON को ऑनलाइन फ़ॉर्मेट करें, सुंदर बनाएं और वैलिडेट करें.
JSON को मिनिफाई करें फ़ाइल आकार कम करने के लिए, या इसे उचित इंडेंटेशन के साथ सुंदर बनाएं।
JSON को CSV में और CSV को वापस JSON में रूपांतरित करें, दोनों तरह से. विभाजक चुनें, उद्धृत फ़ील्ड संभालें, और परिणाम कॉपी करें. सब कुछ आपके ब्राउज़र में चलता है.
YAML को JSON में और JSON को वापस YAML में बदलें, दोनों दिशाओं में। कनवर्ट करते समय सत्यापन करता है और स्पष्ट त्रुटियां दिखाता है। सब कुछ आपके ब्राउज़र में चलता है।