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 10, 2026 08:37janwwwjanwwwError
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Oct 29, 2026 22:29Andrew Epstein233.68CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Oct 29, 2026 22:36011,993,773870,000020,480No answer to stdout. Died or killed?
2Oct 10, 2026 08:444,13049,553,42829,172,0008,415,00092,782,592
3Oct 10, 2026 08:444,13548,015,33629,241,0008,388,00092,807,168
4Oct 10, 2026 08:444,13747,967,35229,304,0008,343,00092,721,152
5Oct 10, 2026 08:444,14547,939,81429,344,0008,376,00092,786,688
6Oct 10, 2026 08:444,15148,132,17229,368,0008,415,00092,811,264
7Oct 10, 2026 08:444,15548,239,23029,367,0008,450,00092,712,960
8Oct 10, 2026 08:444,15748,162,93529,385,0008,449,00092,667,904
9Oct 10, 2026 08:444,17248,345,95329,443,0008,524,00092,729,344
10Oct 10, 2026 08:444,17948,971,82829,327,0008,703,00092,770,304