ā08-14-2024 12:16 PM
Hello everyone,
I'm working on a Text-to-Speech (TTS) application where I need to iterate through JSON data retrieved from an API and vocalize each element. The JSON structure is as follows:
{
"array": [
{"elem": "a"},
{"elem": "b"}
]
}
My goal is to loop through each element of the array and use the value for TTS. I set up a counter variable to dynamically access each element in the array using a JSON path expression. However, I'm encountering an issue when trying to use the counter variable dynamically in the path.
Here's path expression I'm using:
This approach doesn't seem to work, although hardcoding the index like $.array[0].elem works perfectly. Does anyone have insights into why dynamic indexing might not be working or how to correctly implement it in this context?
Thank you in advance for your help!
Solved! Go to Solution.
ā08-27-2024 11:50 AM
Try referring the variable in the braces $.array{{counter}}.elem
You can only refer variables in the braces
ā08-23-2024 12:45 PM
You could also ask in the Webex Contact Center Fellowship Webex Space.
ā08-27-2024 11:50 AM
Try referring the variable in the braces $.array{{counter}}.elem
You can only refer variables in the braces
ā08-30-2024 05:05 PM
Thank you!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide