XML से JSON कन्वर्टर
Example
Input:
<person><name>Ali</name><age>30</age></person>
Output:
{
"person": {
"name": "Ali",
"age": 30
}
}इस converter के बारे में
यह converter XML को एक असली parser (regex नहीं) से parse करता है और इसे standard conventions से JSON में map करता है: बिना attributes और बिना children वाला element उसका text value बनता है, obvious numbers और booleans typed के साथ; attributes @name keys के रूप में सुरक्षित रहते हैं ताकि कुछ न खोए; tag साझा करने वाले siblings उस tag के नीचे एक array में collapse होते हैं; mixed content अपना text #text के नीचे रखता है। वे conventions output को predictable और इस site के JSON से XML converter के साथ round-trippable बनाते हैं। Namespaces tag names में literally रखे जाते हैं (prefix:local), क्योंकि उन्हें चुपके से हटाना वह तरीका है जिससे data pipelines अर्थ खोती हैं।
अक्सर पूछे जाने वाले सवाल
Single child array क्यों नहीं बना?
एक occurrence को lone element से अलग नहीं किया जा सकता; arrays दो या अधिक same-tag siblings से बनते हैं — XML-to-JSON mapping की universal अस्पष्टता।
Comments और XML declaration का क्या होता है?
वे data purposes के लिए structural noise हैं और हटा दिए जाते हैं; root element top-level key बन जाता है।