ولّد واجهات TypeScript من عينة JSON، مع الأنواع المتداخلة والمصفوفات والحقول الاختيارية. يعمل داخل متصفحك.
كيفية استخدام JSON إلى 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.
الأسئلة الشائعة
يصبح كل كائن متداخل واجهة مسماة خاصة به، يُشار إليها من الواجهة الأم، فتكون النتيجة نظيفة وقابلة لإعادة الاستخدام.
تُدمج مصفوفات الكائنات في واجهة واحدة، وتُوسم المفاتيح المفقودة من بعض العناصر بأنها اختيارية. وتصبح مصفوفات القيم البدائية المختلطة نوع عنصر اتحادي (union).
لا. تُولَّد الأنواع بالكامل داخل متصفحك، لذا لا تغادر بياناتك جهازك أبدا.
ضمّن هذه الأداة
أضف هذه الأداة إلى موقعك الخاص. انسخ المقتطف أدناه، ويبقى محدّثاً تلقائياً.
<iframe src="https://monu.tools/embed/ar/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 في كلا الاتجاهين. يتحقق من الصحة أثناء التحويل ويعرض أخطاء واضحة. كل شيء يعمل داخل متصفحك.