Looping through objects

My data source is a nested JSON object.

In each object, there is a JSON array with persons involved. It can contain one to several items. Each person item also have a JSON array with information about previous articles, if any:

Skärmavbild 2020-01-24 kl. 11.16.34

What I would want is to loop through the first array and output the “age” and “sex” (male/female) in a phrase Then, for each person, I would like to loop through the object array and create phrases for those too.

Example:

The male 21 year old was now sentenced to prison for six years for narcotics crime. This is not his first brush with the law. He is previously convicted in 2015 for assault and theft, and in 2016 for driving under the influence of alcohol. He was convicted to six years in prison.

In other situations I have set up triggers to count the items in a list, and then define different branches in Write. But in those scenarios I worked with strings, not objects, and I cannot reference objects in Write (like “variable.key” or “variable[key]”).

Is there any guide available? I would love to learn more about working with nested JSON objects and arrays.

Hi Martin!

Yes, we have a tutorial on what we call “Statement Loops” where you can pretty much prepare a story and apply it to each list object repetitively.

A webinar on how to use this is here:

Please let me know if this helps or if you need further assistance :slightly_smiling_face:

Fantastic! Can’t wait for monday…

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.