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 18, 2026 02:45Josu San MartinJosu San MartinError
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:3809,162,48501,111,0002,117,632EOF
2Sep 9, 2026 02:3808,756,879936,00002,117,632EOF
3Sep 9, 2026 02:3809,325,229937,00002,117,632EOF
4Aug 18, 2026 02:573,89443,555,42418,321,00017,122,00094,392,320
5Aug 18, 2026 02:573,90743,710,64618,345,00017,209,00094,392,320
6Aug 18, 2026 02:573,91143,728,39618,339,00017,253,00094,392,320
7Aug 18, 2026 02:573,91143,854,57918,340,00017,252,00094,392,320
8Aug 18, 2026 02:573,91844,187,28418,370,00017,287,00094,392,320
9Aug 18, 2026 02:573,93543,835,76618,431,00017,385,00094,392,320
10Aug 18, 2026 02:573,94144,091,00518,462,00017,410,00094,392,320
11Aug 18, 2026 02:573,95144,006,73418,516,00017,442,00094,392,320
12Aug 18, 2026 02:574,04250,114,09418,549,00018,239,00094,392,320