I'm trying to build a web app that can perform a semantic search using natural language and return the answer as a result. Using response.data.results, I am able to see the caption text in the console under semanticSearch->captions->text.
However I can't figure out what is the syntax to access that info. I tried response.data.results.semanticSearch.captions[0].text but that is giving me an error "TypeError: Cannot read properties of undefined (reading 'captions')"
Any advice would be much appreciated.
Thanks! Kenneth
So, assuming that JSON on your screenshot coming from the log
response.data.results, it turns out it that's an array. You just need to specify the indice like;