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 listSep 5, 2026 08:04C#_userC#_userScore: 18,517Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Sep 5, 2026 08:2118,450177,673,35062,420,000105,477,00092,332,032
2Sep 5, 2026 08:2118,462177,795,18662,423,000105,585,00092,332,032
3Sep 5, 2026 08:2118,499178,140,78962,535,000105,814,00092,332,032
4Sep 5, 2026 08:2118,506178,263,83962,517,000105,889,00092,299,264
5Sep 5, 2026 08:2118,517178,309,40662,461,000106,050,00092,332,032
6Sep 5, 2026 08:2118,519179,929,72462,422,000106,101,00092,332,032
7Sep 5, 2026 08:2118,527178,375,00562,554,000106,044,00092,332,032
8Sep 5, 2026 08:2118,590183,114,75962,850,000106,323,00092,332,032
9Sep 5, 2026 08:2118,619179,338,18963,325,000106,114,00092,332,032