I have a Node.js API that returns JSON formatted like this:
[
    {
        "id" : "1",
        "tstamp": "2017-06-01T00:00:00.000Z",
        "dmemberprofiles","48400"
        "dgroupprofiles","4800"
        "msclprofiles","400"
    },
    {
        "id" : "2",
        "tstamp" : "2017-06-02T00:00:00.000Z",
        "dmemberprofiles","48700"
        "dgroupprofiles","4900"
        "msclprofiles","410
    }
]
How do I make Node.js return the JSON, looking like this:
{
    "header": [
        "id",
        "tstamp",
        "dmemberprofiles",
        "dgroupprofiles",
        "msclprofiles"
    ],
    "data": [
        {
            "id" : "1",
            "tstamp" : "2017-06-01T00:00:00.000Z",
            "dmemberprofiles","48400"
            "dgroupprofiles","4800"
            "msclprofiles","400"
        },
        {
            "id" : "2",
            "tstamp" : "2017-06-02T00:00:00.000Z",
            "dmemberprofiles","48700"
            "dgroupprofiles","4900"
            "msclprofiles","410
        }           
    ]
}
I've looked around for other examples but haven't found a Node.js-specific solution.
 
     
     
    