Array JSON body - HTTP POST request


#1

I need to send a JSON array in a POST request body. I’m using HTTP native. I have explored some different ways in order to get it:
1.-
let body = [];
body.push({ userId: 1, msg: ‘comment A’ });
body.push({ userId: 2, msg: ‘comment D’ });
body.push({ userId: 3, msg: ‘comment C’ });
HTTPResponse = await this.http.post(url, body, headers);
2.-
body : string = ‘[ { “userId”: 1, “msg”: “comment A” }, { “userId”: 2, “msg”: “comment B” },{ “userId”: 3, “msg”: “comment C” }]’;
HTTPResponse = await this.http.post(url, body, headers);
or
HTTPResponse = await this.http.post(url, JSON.parse(body), headers);

Nothing is going fine, Any help?