restructuring json data in reactjs

This is the json data I am pulling from the backend API:

[
    {
        "year": 2024,
        "month": 7,
        "revenue": 27000
    },
    {
        "year": 2024,
        "month": 8,
        "revenue": 27000
    }
]

However in order to use nivo line charts to graph the data the data must be in the following format.


Array<{
    id:   string | number
    data: Array<{
        x: number | string | Date
        y: number | string | Date
    }>
}>

I can manipulate the data on the backend but I’m having a hard time figuring out whether it’s easier to manipulate the data via the frontend to arrange in this format.