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 16, 2026 09:57marko1597marko1597Error
Source Code

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

Challenge History
DateChallengerCostTypeStatus
Sep 9, 2026 02:23C#_user10.00CustomSolution Broken
Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 9, 2026 02:2809,624,78401,346,00028,672EOFstderr
2Sep 9, 2026 02:2809,584,89501,352,00032,768EOFstderr
3Sep 9, 2026 02:2809,569,85501,359,00032,768EOFstderr
4Aug 16, 2026 10:172,89036,039,24817,715,0008,586,00092,782,592stderr
5Aug 16, 2026 10:172,90734,820,23117,831,0008,628,00092,725,248stderr
6Aug 16, 2026 10:172,90834,909,29018,088,0008,383,00092,737,536stderr
7Aug 16, 2026 10:172,90935,672,85617,835,0008,644,00092,721,152stderr
8Aug 16, 2026 10:172,91235,576,25117,852,0008,656,00092,753,920stderr
9Aug 16, 2026 10:172,91534,950,56218,139,0008,388,00092,803,072stderr
10Aug 16, 2026 10:172,91934,931,67917,866,0008,699,00092,807,168stderr
11Aug 16, 2026 10:172,94335,155,52818,288,0008,501,00092,733,440stderr
12Aug 16, 2026 10:172,94335,138,22718,289,0008,499,00092,729,344stderr