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 4, 2026 20:36Tomislav TunkovicTomislav TunkovicScore: 2,909Success
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 9, 2026 04:53C#_user10.00CustomSolution Held
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 4, 2026 20:472,89036,044,62517,502,0008,804,00092,749,824
2Sep 4, 2026 20:472,89536,166,56817,535,0008,816,00092,684,288
3Sep 4, 2026 20:472,90136,055,25917,538,0008,865,00092,749,824
4Sep 4, 2026 20:472,90736,246,91517,564,0008,893,00092,745,728
5Sep 4, 2026 20:472,90936,352,23517,586,0008,891,00092,749,824
6Sep 4, 2026 20:472,91336,204,78517,585,0008,925,00092,766,208
7Sep 4, 2026 20:472,92636,342,03417,633,0008,994,00092,729,344
8Sep 4, 2026 20:472,92636,366,72317,072,0009,563,00092,762,112
9Sep 4, 2026 20:472,93136,482,12917,099,0009,580,00092,721,152