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 24, 2026 16:47C#_userC#_userScore: 18,249Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Aug 24, 2026 16:5518,099174,523,59261,191,000103,513,00092,352,512
2Aug 24, 2026 16:5518,164175,112,60461,382,000103,915,00092,332,032
3Aug 24, 2026 16:5518,172175,142,78361,424,000103,944,00092,332,032
4Aug 24, 2026 16:5518,178175,220,37061,417,000104,005,00092,332,032
5Aug 24, 2026 16:5518,249175,866,87061,504,000104,562,00092,332,032
6Aug 24, 2026 16:5518,299176,241,55161,351,000105,171,00092,332,032
7Aug 24, 2026 16:5518,315176,432,68061,327,000105,348,00092,332,032
8Aug 24, 2026 16:5518,327177,018,45761,516,000105,265,00092,332,032
9Aug 24, 2026 16:5518,419177,426,55961,394,000106,225,00092,332,032