I get this Object as a response from an API:
{
"transcript": {
"monologues": [
{
"speaker": 0,
"elements": [
{
"type": "text",
"value": "Bobby",
"ts": 2.99,
"end_ts": 3.55,
"confidence": 0.82
},
{ "type": "punct", "value": " " },
{
"type": "text",
"value": "tell",
"ts": 6.99,
"end_ts": 7.47,
"confidence": 0.74
},
{ "type": "punct", "value": " " },
{
"type": "text",
"value": "them",
"ts": 7.47,
"end_ts": 7.63,
"confidence": 0.44
},
{ "type": "punct", "value": "." }
]
}
]
}
}
How do i get "speaker" and "value" from the "elements" array?
I tried to map through the "monologues" array and then nest another map of the "elements" array like this:
{transcription.transcript?.monologues.map((monologue, i) => {
return monologue.elements.map((text, i) => {
return <p>{text.value}</p>;
});
})}
but for some reason it's not working. What am i doing wrong?