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 11, 2026 01:26janwwwjanwwwError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Oct 29, 2026 22:26Andrew Epstein62.77CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 29, 2026 22:28011,465,832773,000020,480No answer to stdout. Died or killed?
2Oct 11, 2026 01:313,28238,835,16021,391,0008,481,00092,712,960
3Oct 11, 2026 01:313,28538,904,77721,410,0008,485,00092,737,536
4Oct 11, 2026 01:313,29038,808,40121,426,0008,514,00092,721,152
5Oct 11, 2026 01:313,29238,913,36921,418,0008,542,00092,758,016
6Oct 11, 2026 01:313,29338,926,38321,370,0008,598,00092,696,576
7Oct 11, 2026 01:313,29339,021,72721,391,0008,584,00092,782,592
8Oct 11, 2026 01:313,30342,540,10221,399,0008,663,00092,778,496
9Oct 11, 2026 01:313,30639,036,23021,412,0008,678,00092,807,168
10Oct 11, 2026 01:313,30839,672,31121,583,0008,528,00092,708,864