RevealTheme logo

Konwerter XML na JSON

Konwertuj dokumenty XML na JSON. Atrybuty są zamieniane na klucze z prefiksem @; powtarzające się znaczniki są zamieniane na tablice.

Jak korzystać z tego narzędzia

  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.

Czym jest konwerter XML na JSON?

Przejście z XML na JSON wiąże się z pewnymi stratami: XML obsługuje przestrzenie nazw, instrukcje przetwarzania i sekcje CDATA, które nie mają bezpośrednich odpowiedników w JSON. Ten konwerter obsługuje 90% przypadków: zagnieżdżone elementy, atrybuty (z prefiksem @) oraz zawartość tekstową (#text). W przypadku złożonego XML może być potrzebna dedykowana biblioteka.

Typowe przypadki użycia

  • 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.

Najczęściej zadawane pytania

Czym jest prefiks @?
Atrybuty są przechowywane jako @nazwaatrybutu, aby odróżnić je od elementów podrzędnych o tej samej nazwie.

Powiązane narzędzia