Js json data structure transformation

recently, the structure required by the structure diagram for a data display is as follows:

{

"nodes": [
    {
        "id": 1,
        "name": "",
        "ntype": "Human",
        "hrefs":"www.baidu.com"
    },
    
    {
        "id": 3,
        "name": "",
        "ntype": "Human",
        "hrefs":"www.baidu.com"
    },
    {
        "id": 4,
        "name": "",
        "ntype": "Company"

    },
    {
        "id": 2,
        "name": "",
        "ntype": "Company"
    }
    ,{
        "id": 5,
        "name": "",
        "ntype": "Company"
    }
    ,{
        "id": 6,
        "name": "",
        "ntype": "Company"
    } ,{
        "id": 7,
        "name": "",
        "ntype": "Company"
    }
],
"relations": [
    {
        "id":43,
        "startNode":3,
        "endNode":7,
        "label":"",
        "type":"SERVE"
    },
    {
        "id":40,
        "startNode":3,
        "endNode":6,
        "label":"",
        "type":"OWN"
    },
    {
        "id":41,
        "startNode":3,
        "endNode":5,
        "label":"",
        "type":"OWN"
    },
    {
        "id": 10,
        "startNode": 1,
        "endNode": 2,
        "label": "",
        "type": "OWN"
    },
    {
        "id": 11,
        "startNode": 1,
        "endNode": 4,
        "label": "",
        "type": "OWN"
    },
    {
        "id": 12,
        "startNode": 1,
        "endNode": 4,
        "label": "",
        "type": "SERVE"
    },
    {
        "id": 13,
        "startNode": 1,
        "endNode": 4,
        "label": "",
        "type": "SERVE"
    },
    {
        "id": 14,
        "startNode": 1,
        "endNode": 4,
        "label": "",
        "type": "SERVE"
    },
    {
        "id": 25, 
        "startNode": 3,
        "endNode": 4,
        "label": "",
        "type": "SERVE"
    },
    {
        "id": 26, 
        "startNode": 3,
        "endNode": 4,
        "label": "",
        "type": "SERVE"
    },
    {
        "id": 27, 
        "startNode": 2,
        "endNode": 4,
        "label": "",
        "type": "INVEST_C"
    },{
        "id": 22, 
        "startNode": 3,
        "endNode": 2,
        "label": "",
        "type": "SERVE"
    },
    {
        "id": 23, 
        "startNode": 3,
        "endNode": 2,
        "label": "",
        "type": "SERVE"
    },
    {
        "id": 24, 
        "startNode": 3,
        "endNode": 4,
        "label": "",
        "type": "SERVE"
    }
]

}

but the data obtained from the background goes like this:
{

"results": [
    {
        "columns": [
            "relationships(ph)"
        ],
        "data": [
            {
                "graph": {
                    "nodes": [
                        {
                            "id": "1106",
                            "labels": [
                                "Person"
                            ],
                            "properties": {
                                "born": 1956,
                                "name": "Tom Hanks"
                            }
                        },
                        {
                            "id": "1194",
                            "labels": [
                                "Movie"
                            ],
                            "properties": {
                                "tagline": "A stiff drink. A little mascara. A lot of nerve. Who said they couldn"t bring down the Soviet empire.",
                                "title": "Charlie Wilson"s War",
                                "released": 2007
                            }
                        },
                        {
                            "id": "1131",
                            "labels": [
                                "Person"
                            ],
                            "properties": {
                                "born": 1931,
                                "name": "Mike Nichols"
                            }
                        }
                    ],
                    "relationships": [
                        {
                            "id": "3367",
                            "type": "ACTED_IN",
                            "startNode": "1106",
                            "endNode": "1194",
                            "properties": {
                                "roles": [
                                    "Rep. Charlie Wilson"
                                ]
                            }
                        },
                        {
                            "id": "3370",
                            "type": "DIRECTED",
                            "startNode": "1131",
                            "endNode": "1194",
                            "properties": {}
                        }
                    ]
                }
            },
            {
                "graph": {
                    "nodes": [
                        {
                            "id": "1106",
                            "labels": [
                                "Person"
                            ],
                            "properties": {
                                "born": 1956,
                                "name": "Tom Hanks"
                            }
                        },
                        {
                            "id": "1194",
                            "labels": [
                                "Movie"
                            ],
                            "properties": {
                                "tagline": "A stiff drink. A little mascara. A lot of nerve. Who said they couldn"t bring down the Soviet empire.",
                                "title": "Charlie Wilson"s War",
                                "released": 2007
                            }
                        },
                        {
                            "id": "1183",
                            "labels": [
                                "Person"
                            ],
                            "properties": {
                                "born": 1967,
                                "name": "Philip Seymour Hoffman"
                            }
                        }
                    ],
                    "relationships": [
                        {
                            "id": "3367",
                            "type": "ACTED_IN",
                            "startNode": "1106",
                            "endNode": "1194",
                            "properties": {
                                "roles": [
                                    "Rep. Charlie Wilson"
                                ]
                            }
                        },
                        {
                            "id": "3369",
                            "type": "ACTED_IN",
                            "startNode": "1183",
                            "endNode": "1194",
                            "properties": {
                                "roles": [
                                    "Gust Avrakotos"
                                ]
                            }
                        }
                    ]
                }
            },
                 ]
    }
],
"errors": []

}

Sep.27,2021
Menu