Parsing text from JSON

Hi !
I have the following JSON that I would like to parse each text from subtitle array in one string variable. What’s the best option for that ?

Thanks!

JSON:
[
{
“statusCode”: 200,
“headers”: [
{
“name”: “date”,
“value”: “Tue, 14 Jan 2025 20:19:21 GMT”
},
{
“name”: “content-type”,
“value”: “application/json”
},
{
“name”: “content-length”,
“value”: “21934”
},
{
“name”: “connection”,
“value”: “keep-alive”
},
{
“name”: “x-youtube-v2-daily-usage”,
“value”: “294853”
},
{
“name”: “x-ratelimit-requests-limit”,
“value”: “200”
},
{
“name”: “x-ratelimit-requests-remaining”,
“value”: “176”
},
{
“name”: “x-ratelimit-requests-reset”,
“value”: “2674290”
},
{
“name”: “x-ratelimit-rapid-free-plans-hard-limit-limit”,
“value”: “500000”
},
{
“name”: “x-ratelimit-rapid-free-plans-hard-limit-remaining”,
“value”: “499981”
},
{
“name”: “x-ratelimit-rapid-free-plans-hard-limit-reset”,
“value”: “2674290”
},
{
“name”: “server”,
“value”: “RapidAPI-1.2.8”
},
{
“name”: “x-rapidapi-version”,
“value”: “1.2.8”
},
{
“name”: “x-rapidapi-region”,
“value”: “AWS - us-east-1”
},
{
“name”: “x-rapidapi-request-id”,
“value”: “02433baf6f3f5d0d0eeeeaa3ad72debeb8be851e228d19205bd5760f21261746”
}
],
“cookieHeaders”: ,
“data”: {
“lang”: “pt”,
“is_available”: true,
“subtitles”: [
{
“id”: 1,
“start”: 4.48,
“duration”: 5.96,
“text”: “Olá pessoal tudo bem então hoje”
},
{
“id”: 2,
“start”: 7.359,
“duration”: 6.36,
“text”: “sexta-feira 10 de janeiro nós vamos”
},
{
“id”: 3,
“start”: 10.44,
“duration”: 6.08,
“text”: “inverter um pouquinho pelo menos essa”
},
{
“id”: 4,
“start”: 13.719,
“duration”: 4.841,
“text”: “semana acho que não vai ficar ruim para”
},
{
“id”: 5,
“start”: 16.52,
“duration”: 4.839,
“text”: “vocês eu”
},
{
“id”: 6,
“start”: 18.56,
“duration”: 6.2,
“text”: “vou comentar o resultado dos Leilões”
},
{
“id”: 7,
“start”: 21.359,
“duration”: 6.201,
“text”: “dessa semana dentro da mesma semana eu”
},
{
“id”: 8,
“start”: 24.76,
“duration”: 4.72,
“text”: “tô com a ideia de fazer isso pessoal em”
},
{
“id”: 9,
“start”: 27.56,
“duration”: 5.6,
“text”: “definitivo no canal deixem as opiniões”
},
{
“id”: 10,
“start”: 29.48,
“duration”: 5.759,
“text”: “aí nos comentários deixar na sexta-feira”
},
{
“id”: 11,
“start”: 33.16,
“duration”: 4,
“text”: “da mesma semana o comentário sobre os”
},
{
“id”: 12,
“start”: 35.239,
“duration”: 5.401,
“text”: “leilões trocar né que eu fazia isso”
},
{
“id”: 13,
“start”: 37.16,
“duration”: 5.559,
“text”: “sempre na terça-feira seguinte deixar”
},
{
“id”: 14,
“start”: 40.64,
“duration”: 4.559,
“text”: “isso na sexta de manhã o que que vocês”
},
{
“id”: 15,
“start”: 42.719,
“duration”: 4.921,
“text”: “acham E na”
},
{
“id”: 16,
“start”: 45.199,
“duration”: 5.961,
“text”: “terça-feira eu faço o”
},
{
“id”: 17,
“start”: 47.64,
“duration”: 6.52,
“text”: “perguntão Então essa semana que vem dia”
},
{
“id”: 18,
“start”: 51.16,
“duration”: 5.48,
“text”: “14 nós teremos o perguntão como é que”
},
{
“id”: 19,
“start”: 54.16,
“duration”: 6.399,
“text”: “faz para participar do perguntão escreve”
},
{
“id”: 20,
“start”: 56.64,
“duration”: 7.239,
“text”: “perguntão dois pontos e manda a braba e”
},
{
“id”: 21,
“start”: 60.559,
“duration”: 4.921,
“text”: “manda a braba lá tá eh Claro sobre”
},
{
“id”: 22,
“start”: 63.879,
“duration”: 3.6,
“text”: “tesouro direto eu”
},
{
“id”: 23,
“start”: 65.48,
“duration”: 5.639,
“text”: “[Música]”
},
{
“id”: 24,
“start”: 67.479,
“duration”: 7.481,
“text”: “eh eu posso eu posso então fazer isso às”
},
{
“id”: 25,
“start”: 71.119,
“duration”: 6.161,
“text”: “terças-feiras e eu tava pensando eh ah”
},
{
“id”: 26,
“start”: 74.96,
“duration”: 5.64,
“text”: “mas eu não não consigo ter a minha”
},
{
“id”: 27,
“start”: 77.28,
“duration”: 6.28,
“text”: “pergunta respondida etc etc olha pessoal”
},
{
“id”: 28,
“start”: 80.6,
“duration”: 4.839,
“text”: “vai vai tentando tá vai tentando Qual o”
},
{
“id”: 29,
“start”: 83.56,
“duration”: 3.72,
“text”: “que que eu vou tentar fazer tentar não”
},
{
“id”: 30,
“start”: 85.439,
“duration”: 5.32,
“text”: “passar de meia hora tentar fazer isso”
},
{
“id”: 31,
“start”: 87.28,
“duration”: 5.799,
“text”: “por meia hora porque eu vejo que quanto”
},
{
“id”: 32,
“start”: 90.759,
“duration”: 5.161,
“text”: “mais tempo um vídeo tem no YouTube menos”
},
{
“id”: 33,
“start”: 93.079,
“duration”: 5.281,
“text”: “assistido ele é menos retenção ele tem”
},
{
“id”: 34,
“start”: 95.92,
“duration”: 5.44,
“text”: “então vai meia hora eu acho que é o”
},
{
“id”: 35,
“start”: 98.36,
“duration”: 4.28,
“text”: “limite máximo assim Vídeos maiores do”
},
{
“id”: 36,
“start”: 101.36,
“duration”: 4.32,
“text”: “que meia hora eu acho que não vale a”
},
{
“id”: 37,
“start”: 102.64,
“duration”: 6.72,
“text”: “pena fazer tá então Vamos aos”
},
{
“id”: 38,
“start”: 105.68,
“duration”: 5.52,
“text”: “comentários do leilão dos Leilões desta”
},
{
“id”: 39,
“start”: 109.36,
“duration”: 5.399,
“text”: “semana como vocês estão vendo aqui na”
},
{
“id”: 40,
“start”: 111.2,
“duration”: 5.72,
“text”: “página do Tesouro Nacional nós temos”
},
{
“id”: 41,
“start”: 114.759,
“duration”: 5.72,
“text”: “seis editais aqui e um edital sem”
},
{
“id”: 42,
“start”: 116.92,
“duration”: 7.479,
“text”: “resultados né Pois é guard essa”
},
{
“id”: 43,
“start”: 120.479,
“duration”: 3.92,
“text”: “informação tá guardem essa”
},
{
“id”: 44,
“start”: 124.479,
“duration”: 4.161,
“text”: “informação começando pessoal aqui”
},
{
“id”: 45,
“start”: 128.92,
“duration”: 7.399,
“text”: “na terça-feira dessa semana dia 7 nós”
},
{
“id”: 46,
“start”: 134.04,
“duration”: 5.12,
“text”: “tivemos opa não é isso aqui que eu quero”
},
{
“id”: 47,
“start”: 136.319,
“duration”: 7.721,
“text”: “mostrar esse aqui nós tivemos leilão de”
},
{
“id”: 48,
“start”: 139.16,
“duration”: 6,
“text”: “tesouro IPCA IPCA 30 nessa semana esse é”
},
{
“id”: 49,
“start”: 144.04,
“duration”: 3.839,
“text”: “o prazo mais”
},
{
“id”: 50,
“start”: 145.16,
“duration”: 4.359,
“text”: “curto o problema é a taxa né que o Nosso”
},
{
“id”: 51,
“start”: 147.879,
“duration”: 3.961,
“text”: “tesouro vai pagar ou seja que nós vamos”
},
{
“id”: 52,
“start”: 149.519,
“duration”: 2.321,
“text”: “pagar”
},
{
“id”: 53,
“start”: 152.2,
“duration”: 4.96,
“text”: “7.72”
},
{
“id”: 54,
“start”: 153.8,
“duration”: 5.92,
“text”: “150.000 títulos 1. 250.000 vendidos”
},
{
“id”: 55,
“start”: 157.16,
“duration”: 5.28,
“text”: “tesouro IPCA mais 2030 com juros”
},
{
“id”: 56,
“start”: 159.72,
“duration”: 6.76,
“text”: “semestrais a IPCA mais”
},
{
“id”: 57,
“start”: 162.44,
“duration”: 6.2,
“text”: “7.7 vendeu absolutamente tudo também né”
},
{
“id”: 58,
“start”: 166.48,
“duration”: 5,
“text”: “pessoal o institucional que não comprar”
},
{
“id”: 59,
“start”: 168.64,
“duration”: 6.8,
“text”: “isso tá com problema né tá com problema”
},
{
“id”: 60,
“start”: 171.48,
“duration”: 7.8,
“text”: “aí na na sua na sua métrica de avaliação”
},
{
“id”: 61,
“start”: 175.44,
“duration”: 6.96,
“text”: “porque esse esse título aí nós não temos”
},
{
“id”: 62,
“start”: 179.28,
“duration”: 5.8,
“text”: “no Tesouro e essa taxa também nós”
},
{
“id”: 63,
“start”: 182.4,
“duration”: 6.44,
“text”: “estamos vendo set baixo agora no tesouro”
},
{
“id”: 64,
“start”: 185.08,
“duration”: 7.079,
“text”: “e não set alto como nós tivemos nesse”
},
{
“id”: 65,
“start”: 188.84,
“duration”: 5.8,
“text”: “leilão aqui do dia 7 de janeiro Então”
},
{
“id”: 66,
“start”: 192.159,
“duration”: 4.36,
“text”: “pessoal aquela turma lá que faz aquele”
},
{
“id”: 67,
“start”: 194.64,
“duration”: 5,
“text”: “couro que ai o tesouro não consegue”
},
{
“id”: 68,
“start”: 196.519,
“duration”: 6.521,
“text”: “vender não consegue se financiar e tal”
},
{
“id”: 69,
“start”: 199.64,
“duration”: 7.44,
“text”: “de novo não é bem assim olha aí pessoal”
},
{
“id”: 70,
“start”: 203.04,
“duration”: 5.72,
“text”: “vendeu vendeu 150.000 papéis e os outros”
},
{
“id”: 71,
“start”: 207.08,
“duration”: 3.2,
“text”: “prazos estão”
},
{
“id”: 72,
“start”: 208.76,
“duration”: 8.24,
“text”: “aqui”
},
{
“id”: 73,
“start”: 210.28,
“duration”: 8.8,
“text”: “eh 150.000 papéis para 35 aí vendeu 1/3”
},
{
“id”: 74,
“start”: 217,
“duration”: 6.72,
“text”: “aqui realmente não vendeu a”
},
{
“id”: 75,
“start”: 219.08,
“duration”: 8.359,
“text”: “7,61 uma baita taxa mas não vendeu e o”
},
{
“id”: 76,
“start”: 223.72,
“duration”: 6.32,
“text”: “de 60 a 300.000 papéis vendeu tudo à”
},
{
“id”: 77,
“start”: 227.439,
“duration”: 5.681,
“text”: “7:32 aqui provavelmente foi fundo de”
}

}

]

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
3 Likes

Thank you!
It worked

1 Like