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:02C#_userC#_userScore: 18,327Success
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:1318,224175,602,58761,328,000104,516,00092,332,032
2Sep 5, 2026 08:1318,271176,168,18461,377,000104,893,00092,332,032
3Sep 5, 2026 08:1318,318176,564,71361,555,000105,140,00092,332,032
4Sep 5, 2026 08:1318,325176,660,58061,311,000105,448,00092,385,280
5Sep 5, 2026 08:1318,327176,648,45761,349,000105,430,00092,332,032
6Sep 5, 2026 08:1318,364176,932,06661,372,000105,741,00092,332,032
7Sep 5, 2026 08:1318,386177,170,57961,429,000105,887,00092,332,032
8Sep 5, 2026 08:1318,387177,080,13361,520,000105,802,00092,332,032
9Sep 5, 2026 08:1318,450177,748,09861,481,000106,415,00092,332,032