XML to JSON Sergey Svistunov

Convert 1,000,000 person records from XML to JSON as fast as possible.

Input

XML document on STDIN:

<?xml version="1.0" encoding="UTF-8"?>
<persons>
    <person id="1512376">
        <age>30</age>
        <height>169.1</height>
        <married>true</married>
        <phone code="+6"><number>1283603279</number></phone>
        <phone code="+6"><number>1659964668</number></phone>
    </person>
    ...
</persons>

Output

One JSON object per person to STDOUT, preserving order:

{
    "id": 1512376,
    "age": 30,
    "height": 169.1,
    "married": true,
    "phones": [
        {
            "code": "+6",
            "number": 1283603279
        },
        {
            "code": "+6",
            "number": 1659964668
        }
    ]
}

Constraints

  • Preserve the order of persons
  • Omit the phones field if the phone array is empty
  • Maximum number of phones per person is 3
Back to listAug 14, 2026 18:08marko1597marko1597Score: 6,766Success
Source Code

Source code access is restricted. Log in to request access.

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 14, 2026 18:166,75971,323,70249,003,00012,512,00092,741,632stderr
2Aug 14, 2026 18:166,75971,367,07749,091,00012,418,00092,745,728stderr
3Aug 14, 2026 18:166,76271,313,43349,118,00012,421,00092,762,112stderr
4Aug 14, 2026 18:166,76571,351,64449,066,00012,498,00092,672,000stderr
5Aug 14, 2026 18:166,76672,179,35049,002,00012,576,00092,758,016stderr
6Aug 14, 2026 18:166,77171,411,10049,072,00012,546,00092,823,552stderr
7Aug 14, 2026 18:166,78971,583,79449,170,00012,613,00092,766,208stderr
8Aug 14, 2026 18:166,80471,713,43749,294,00012,625,00092,721,152stderr
9Aug 14, 2026 18:166,80871,914,08649,271,00012,684,00092,770,304stderr