eastern-cyan
eastern-cyan17mo ago

Help with Accessing Nested JSON Data in API Response

Hello Voiceflow Community, I'm working on integrating an external API with my Voiceflow project and need help with parsing a nested JSON response to extract specific data and store it in Voiceflow variables. Here is the structure of the JSON response I'm dealing with: [ { "recipient_id": "507f1f77bcf86cd7990421", "custom": { "user_id": "507f1f77bcf86cd799489321", "question": { "message": "What food do you have that is gluten free?" }, "summary": "Detailed summary here...", "products_detail": [ { "name": "Product Name", "seo_description": "Description here...", "background": null, "type": "Product Type", "feelings": { "Relaxed": 0, "Sleepy": 0 }, "helps_with": { "Weight": 0, "Digestion": 0 } } ] } } ] What I need: 1. How to correctly use the JSON path notation in Voiceflow to access the name within products_detail. 2. How to store this value into a Voiceflow variable for further use in the conversation. What I've tried: I've attempted using paths like response[0].custom.products_detail[0].name, but it doesn't seem to work. My API call setup is correct, and it works in Postman with the same endpoint and parameters. Any insights or examples of how you handle similar JSON parsing in Voiceflow would be incredibly helpful! Thank you!
3 Replies
W. Williams (SFT)
response[0].custom.products_detail.name is correct try using the Send Request button within the API step can you screenshot the response you get?
eastern-cyan
eastern-cyanOP17mo ago
@W. Williams (SFT)
Hey man! So tried the example you provided "response[0].custom.products_detail.name" And here is the response I get. It returns the entire payload instead of just the "name" key. I'm not sure what that the issue is. Any thoughts?
No description
W. Williams (SFT)
you need to put that in the capture part of the API the Send Request gets the whole response

Did you find this page helpful?