#C13744. XML to JSON Conversion

    ID: 43316 Type: Default 1000ms 256MiB

XML to JSON Conversion

XML to JSON Conversion

You are given a well-formed XML string without attributes. Your task is to convert the XML into a structured JSON format, preserving the hierarchical relationships and nested structures. If an XML tag has no content (i.e. an empty tag), it should be converted to null in JSON. If multiple sibling tags share the same name, their values should be grouped into an array.

The JSON output must be formatted with an indentation of 4 spaces.

Note: All formulas, if any, must be written in LaTeX format.

inputFormat

The input consists of a single XML string read from stdin.

Example:

<root><child>value</child></root>

outputFormat

Output the JSON formatted string with an indentation of 4 spaces to stdout.

## sample
value
{
"root": {
    "child": "value"
}

}

</p>