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 listSep 10, 2026 00:17Andrew EpsteinAndrew EpsteinError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 10, 2026 08:31Tomislav Tunkovic10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 10, 2026 08:32021,367,2211,561,000020,480Exit with code 1:
2Sep 10, 2026 00:227,33577,014,10549,828,00016,923,00094,392,320
3Sep 10, 2026 00:227,48280,371,58450,817,00017,276,00094,392,320
4Sep 10, 2026 00:227,51079,311,14751,441,00016,900,00094,392,320
5Sep 10, 2026 00:227,61980,306,01152,374,00016,967,00094,396,416
6Sep 10, 2026 00:227,65780,611,39452,714,00016,969,00094,392,320
7Sep 10, 2026 00:227,66480,065,76453,552,00016,195,00094,392,320
8Sep 10, 2026 00:227,66780,041,54853,698,00016,075,00094,392,320
9Sep 10, 2026 00:227,69080,177,36353,886,00016,102,00094,392,320
10Sep 10, 2026 00:227,73081,251,17753,430,00016,919,00094,392,320