I am making a Node.js & Express app that gets records from a CRM. I'm trying to show the data on a html page by sending the data with:
app.get('/user', (req, res) => {
let stringify = JSON.stringify(responseObject);
res.send(stringify);
});
The response I get is:
{
data: [
{
keyValues: {},
keyModified: {}
}
],
info: {
perPage: 200,
count: 1,
page: 1,
moreRecords: false,
keyModified: { }
},
keyModified: { }
}
I want to display only the data within the "keyValues" object, which contains the data of the user I'm searching for. How can I make this happen?
You have to extract from responseObject only the informations that you want to send.
Since data is an array you can map on it and select only the keyModified attribute.
Something like this:
app.get('/user', (req, res) => {
res.json(responseObject.data.map(d => d.keyModified))
});