1
votes

I have some code:

const types = [
{ name: "NAME", data: [{"datahere": "datadata"}], id: 87}
];

axiosPost(
    'urlhere'
    {
        Message: {
            Name: name,
            ID: id,
            Payload: {
                title: null,
                data: (data)
            }
        }
    }
)

When I post it, it returns:

"Message": {
    "Name": "NAME",
    "ID": 87,
    "Payload": {
        "title" null,
        "data": "[object Object]"
    }
}

Data needs to be a JSON object, {"datahere": "datadata"} and I need the payload to look like this:

"Message": {
    "Name": "NAME",
    "ID": 87,
    "Payload": {
        "title" null,
        "data": {
            "datahere": "datadata"
        }
    }
}

How do I go about doing this?