RevealTheme logo

XML-naar-JSON-conversie

Converteer XML-documenten naar JSON. Attributen worden omgezet in sleutels met het voorvoegsel @; herhaalde tags worden omgezet in arrays.

Hoe u deze tool gebruikt

  1. 1

    Paste or type your XML into the input box.

  2. 2

    Read the converted JSON in the output panel below, which updates as you type.

  3. 3

    If the XML is malformed, fix the error shown in red and the output will reappear.

  4. 4

    Select the JSON from the output panel to copy it into your project.

Wat is de XML-naar-JSON-conversie?

De overgang van XML naar JSON gaat in sommige opzichten gepaard met verlies: XML ondersteunt naamruimten, verwerkingsinstructies en CDATA-secties die geen directe equivalenten in JSON hebben. Deze converter verwerkt 90 % van de gevallen: geneste elementen, attributen (met voorvoegsel @) en tekstinhoud (#text). Voor complex XML kan een speciale bibliotheek nodig zijn.

Veelvoorkomende toepassingen

  • Inspect a SOAP or legacy XML API response as JSON before wiring it into a JavaScript front end.

  • Convert an RSS or Atom feed snippet into JSON to prototype a parser quickly.

  • Turn a config file or build manifest written in XML into JSON to eyeball its structure.

  • Pull values out of an XML sitemap or data export when a JSON shape is easier to traverse.

  • Teach or learn how attributes, repeated tags, and text nodes map between the two formats.

  • Sanity-check that a small XML payload is well-formed, since malformed input shows a parser error.

Veelgestelde vragen

Wat is het voorvoegsel @?
Attributen worden opgeslagen als @attribuutnaam om ze te onderscheiden van de onderliggende elementen met dezelfde naam.

Gerelateerde tools