cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
cancel
559
Views
2
Helpful
3
Replies

Webex Contact Center Flow iterate through array

nkravchenko
Level 1
Level 1

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:

nkravchenko_0-1723662384220.png

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!

 

1 Accepted Solution

Accepted Solutions

SomeshMaled
Cisco Employee
Cisco Employee

Try referring the variable in the braces $.array{{counter}}.elem
You can only refer variables in the braces

View solution in original post

3 Replies 3

rikardkrvaric
Spotlight
Spotlight

You could also ask in the Webex Contact Center Fellowship Webex Space.

https://eurl.io/#p0-2ddOG3

SomeshMaled
Cisco Employee
Cisco Employee

Try referring the variable in the braces $.array{{counter}}.elem
You can only refer variables in the braces

Thank you!