محوّل XML إلى JSON
حوّل XML إلى JSON مقروء: تصبح السمات مفاتيح @، والعناصر المتكررة مصفوفات، ويبقى CDATA نصًا. تُرفض تعريفات DOCTYPE لدواعي الأمان.
المدخلات
تلميح: اضغط Ctrl + Enter للتشغيل
الإعدادات المحفوظة
المساعدة المفصلة أدناه متاحة بالإنجليزية فقط حاليًا.
حول هذه الأداة
XML feeds, sitemaps, invoices and API responses are easier to work with in JavaScript and most modern tools once they are JSON. This converter parses XML in your browser and produces indented JSON: elements become keys, attributes become keys starting with @, repeated sibling elements become arrays, and CDATA sections become plain text.
For security, documents with a DOCTYPE declaration are rejected, which prevents entity-expansion attacks such as “billion laughs”.
The output follows the same conventions as our JSON to XML converter, so a document converted to JSON, edited and converted back keeps its attributes and repeated elements.
طريقة الاستخدام
- Paste the XML.
- Run it.
- Copy or download the JSON.
كيف يعمل الحساب
The XML is parsed with the browser’s DOMParser (after rejecting DOCTYPE). Each element is converted recursively: attributes → "@name", text → value or "#text" when mixed with children, and siblings with the same name → array.
element → key · attribute → @key · repeated element → arrayمثال تطبيقي
A marketer converts a small product feed with two <entry> elements, each with an id attribute and a title, one of them in CDATA. The JSON has "feed" → "entry" as an array of two objects: {"@id": "1", "title": "Spring sale"} and {"@id": "2", "title": "Fish & chips"}.
القيود
- Values stay strings; numbers are not converted automatically.
- Comments and processing instructions are dropped.
- Documents with DOCTYPE are refused.
آخر تحديث:
الأسئلة الشائعة
Why is a single element not an array?
Only repeated siblings become arrays; a lone element is an object or value.
Are namespaces kept?
Prefixed names are kept as written, such as "dc:title".
Why was my file rejected?
It contains a DOCTYPE, which is refused to prevent XML entity attacks.
استكشاف الأخطاء وإصلاحها
Parse error.
The XML is not well formed; check for unclosed tags or unescaped & characters.
I need numbers, not strings.
Convert types in your code after parsing.
Arrays appear inconsistently.
Elements that sometimes appear once and sometimes several times convert differently; normalize in code.
الخصوصية & مجاني
هل تُخزَّن مدخلاتي؟
تبقى مدخلاتك في علامة التبويب هذه. لا نتلقى ملفاتك أو النصوص الملصقة أو قيم الحسابات.
هل هذه الأداة مجانية؟
نعم. لا يلزم تسجيل أو دفع.
انظر أيضًا
خطوات تالية مفيدة
محوّل JPG إلى PNG
حوّل صور JPG إلى PNG في متصفحك، حتى 30 صورة في المرة الواحدة. يحافظ PNG على كل بكسل ويدعم الشفافية، لذا فهو الأفضل للقطات الشاشة والشعارات والرسومات.
محوّلات الملفاتمحوّل PNG إلى JPG
حوّل صور PNG إلى JPG في متصفحك، حتى 30 صورة في المرة الواحدة. ملفات JPG صغيرة وتُفتح في كل مكان، لذا فهي الأفضل للصور والرفع في النماذج؛ وتصبح المناطق الشفافة بيضاء.
محوّلات الملفاتمحوّل WebP إلى JPG
حوّل صور WebP إلى JPG في متصفحك، حتى 30 صورة في المرة الواحدة. ملفات JPG صغيرة وتُفتح في كل مكان، لذا فهي الأفضل للصور والرفع في النماذج؛ وتصبح المناطق الشفافة بيضاء.
محوّلات الملفات