XML Repetition and JSON Types in Zelivo

Use two small conversions to see repeated elements become arrays, an outer name may disappear, and boolean values may return as XML text.

Updated · 2026-11-29

This guide examines two related behaviors in Zelivo’s XML and JSON tools. A repeated XML element can become a JSON array even when its containing element is not preserved. The reverse conversion also shows that JSON values placed in XML element text need careful interpretation.

XML Repetition and JSON Types in Zelivo
Illustration of the workflow; example values are explained below.

Convert repeated XML elements to JSON

Start with the XML specimen containing an items element and two item entries. The entries are Tea and Café, so the example tests both repetition and preservation of the accented character. Use the xml-to-json tool with the exact sample shown below.

After conversion, locate the item property in the result. The two values should remain strings, appear in their original order, and stay inside one JSON array. This makes the example useful for checking the repeated-element mapping before applying the same pattern to another document.

<items><item>Tea</item><item>Café</item></items>

Notice the omitted parent name

The result is {"item":["Tea","Café"]}. It contains the repeated child name as a property, but it does not contain an items property for the outer element. Record this shape explicitly if later code expects a parent object.

Compare the output character by character with the sample. Confirm that the array has two entries, that Café keeps its accent, and that no additional wrapper was added. This check separates ordering and character handling from assumptions about XML hierarchy.

{"item":["Tea","Café"]}

Convert JSON values to XML

Now paste {"name":"Tea & coffee","active":false} into JSON to XML. The sample tests escaping, the XML declaration, and how a non-string JSON value is represented after conversion.

Inspect the returned source rather than judging only the rendered text. Verify the UTF-8 declaration, the root element, and the child elements name and active. The ampersand should be escaped as &amp;, while the boolean should appear as false.

Interpret types and reuse safely

The XML output contains <active>false</active>, but XML element text does not carry the original JSON boolean type by itself. A later consumer must apply an agreed rule or schema if it needs to distinguish false from the string false.

Before reusing this mapping, check the target XML structure and key names. For XML with mixed content or namespaces, verify the conversion on representative samples first. Keep the observed parent omission and text-based type behavior in your integration notes.

  • Repeated item values form one ordered JSON array.
  • The outer items name is omitted from the JSON result.
  • false returns as XML text, not an intrinsic boolean.

Try the related tools

Continue with another guide

Cookie
We care about your data and would love to use cookies to improve your experience.

Learn how we use cookies