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:53marko1597marko1597Error
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 4, 2026 18:32Tomislav Tunkovic48.22CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 4, 2026 18:3409,471,83201,221,00028,672EOFstderr
2Sep 4, 2026 18:3409,275,7651,098,000028,672EOFstderr
3Sep 4, 2026 18:3409,218,9361,095,000028,672EOFstderr
4Aug 14, 2026 19:264,16746,394,86425,597,00012,323,00092,749,824stderr
5Aug 14, 2026 19:264,16946,454,37225,599,00012,346,00092,717,056stderr
6Aug 14, 2026 19:264,17246,474,64725,535,00012,438,00092,672,000stderr
7Aug 14, 2026 19:264,18046,415,26725,628,00012,413,00092,745,728stderr
8Aug 14, 2026 19:264,19746,610,33125,650,00012,548,00092,774,400stderr
9Aug 14, 2026 19:264,19846,666,40225,707,00012,496,00092,700,672stderr
10Aug 14, 2026 19:264,19846,699,57325,730,00012,476,00092,774,400stderr
11Aug 14, 2026 19:264,20447,299,64825,758,00012,502,00092,717,056stderr
12Aug 14, 2026 19:264,22047,441,65325,723,00012,681,00092,766,208stderr