Parsing text from JSON

To parse the text from the subtitle array in the provided JSON and combine it into a single string variable, you can follow these steps:

  1. Use the “Parse JSON” module to process your JSON input.
  2. After parsing, use an “Iterator” module to loop through the subtitles.
  3. Finally, use a “Text Aggregator” module to combine the subtitle texts.

Here’s a more detailed explanation:

Parse JSON

First, use the “Parse JSON” module and input your JSON string. This will allow you to access the individual elements of your JSON structure.

Iterator

Add an “Iterator” module after the “Parse JSON” module. Configure it to iterate over the subtitles array:

  • Set the “Array” field to: {{1.data.subtitles}}

Text Aggregator

After the Iterator, add a “Text Aggregator” module. Configure it as follows:

  • Set the “Text” field to map to the text of each subtitle: {{2.text}}
  • Set the “Separator” to a space character:

This will combine all the text elements from the subtitles array into a single string, with each element separated by a space.

Result

The output of the Text Aggregator module will be a single string containing all the text from the subtitle array, which you can then use in subsequent modules or as your final output.

For the given JSON, the resulting string would be:

Olá pessoal tudo bem então hoje sexta-feira 10 de janeiro nós vamos inverter um pouquinho pelo menos essa semana acho que não vai ficar ruim para