XML to JSON
Convert repeated XML elements to a JSON array and check how the result represents their parent.
Convert repeated XML elements to a JSON array and check how the result represents their parent.
How to use
- Use the sample items element containing item entries for Tea and Café.
- Convert to JSON and locate the item property in the result.
- Check that its array contains both strings in order, including the accent in Café.
Worked example
Input
<items><item>Tea</item><item>Café</item></items>Expected result
{"item":["Tea","Café"]}Check the result
The output is {"item":["Tea","Café"]}. The outer items name is omitted.