Attributes, text and repetition — mapped.
Parsing uses fast-xml-parser with attributes enabled. An attribute becomes a key prefixed with @, element text becomes #text, and two siblings that share a name become an array. Everything else keeps document order.
<order id="7">
<price currency="USD">12.50</price>
<item>a</item>
<item>b</item>
</order> {
"order": {
"price": { "#text": 12.5, "@currency": "USD" },
"item": ["a", "b"],
"@id": "7"
}
}
Three asymmetries to expect
- ▸Element text is type-inferred —
12.50arrived as the number12.5— while attribute values stay strings, which is why@idis quoted. - ▸A single
<item>produces an object rather than a one-element array, so code written against a list breaks the first time a feed contains one entry. - ▸Mixed content folds the loose text into
#textnext to the child keys instead of preserving where it appeared.
NOTE Malformed XML fails with the parser's own message; the offline fallback uses the browser's XML parser and reports the first line of its error. Neither one guesses at a missing close tag.
What you get on this page
- ▸Powered by fast-xml-parser
- ▸Attributes prefixed with @
- ▸Text nodes stored as #text
- ▸Repeated elements become arrays
Because bracekit is a static application, this page loads quickly, caches well and never sends your data to a parsing server. Your formatting preferences, recent documents and snippets stay in local storage.