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 24, 2026 11:49C#_userC#_userError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 5, 2026 05:51Tomislav Tunkovic42.97CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 5, 2026 06:14060,068,857,25659,982,860,00073,666,00032,768Killed by timeout
2Aug 24, 2026 11:5718,205175,439,05061,395,000104,271,00092,332,032
3Aug 24, 2026 11:5718,208175,454,00061,410,000104,286,00092,332,032
4Aug 24, 2026 11:5718,215175,504,78361,259,000104,506,00092,332,032
5Aug 24, 2026 11:5718,256175,989,01561,463,000104,668,00092,332,032
6Aug 24, 2026 11:5718,292176,252,00161,470,000104,993,00092,332,032
7Aug 24, 2026 11:5718,324176,666,55761,206,000105,550,00092,332,032
8Aug 24, 2026 11:5718,344176,745,02361,515,000105,424,00092,332,032
9Aug 24, 2026 11:5718,351176,767,46162,062,000104,936,00092,385,280
10Aug 24, 2026 11:5718,415177,330,69562,862,000104,715,00092,332,032