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 listOct 17, 2026 07:15janwwwjanwwwError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Oct 29, 2026 22:13Andrew Epstein10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 29, 2026 22:1609,465,993624,000016,384No answer to stdout. Died or killed?
2Oct 17, 2026 07:223,26738,735,13721,157,0008,580,00092,770,304
3Oct 17, 2026 07:223,27238,729,60421,143,0008,635,00092,737,536
4Oct 17, 2026 07:223,27638,719,76821,526,0008,290,00092,717,056
5Oct 17, 2026 07:223,27838,892,99821,355,0008,478,00092,782,592
6Oct 17, 2026 07:223,28038,790,07721,147,0008,708,00092,749,824
7Oct 17, 2026 07:223,28138,830,00621,399,0008,465,00092,786,688
8Oct 17, 2026 07:223,28338,869,60921,173,0008,705,00092,717,056
9Oct 17, 2026 07:223,28338,793,93421,177,0008,704,00092,717,056
10Oct 17, 2026 07:223,30139,021,15321,419,0008,623,00092,684,288