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 listJul 1, 2026 21:37A_ShamanA_ShamanScore: 74,062Success
Source Code

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

Challenge History

No challenges yet.

Run Statistics
#DateScoreWall TimeCPU UserCPU SystemMemoryError
1Jul 1, 2026 21:4473,942682,904,953557,458,000115,423,000169,897,984
2Jul 1, 2026 21:4473,953682,893,356557,876,000115,101,000171,991,040
3Jul 1, 2026 21:4473,954682,914,569557,968,000115,014,000169,897,984
4Jul 1, 2026 21:4474,059683,824,959557,892,000116,048,000169,893,888
5Jul 1, 2026 21:4474,062683,878,058557,916,000116,052,000169,897,984
6Jul 1, 2026 21:4474,143684,547,737557,723,000116,979,000169,897,984
7Jul 1, 2026 21:4474,199684,756,875558,232,000116,987,000171,991,040
8Jul 1, 2026 21:4474,314686,216,546558,707,000117,551,000171,995,136
9Jul 1, 2026 21:4474,677689,223,912562,850,000116,717,000171,995,136