Hello everyone,
Sorry for this beginner’s question, but I just can’t find a solution.
I would really appreciate some help on how to properly work with JSON.
I can’t seem to find any information on how to solve this — neither in the mindStudio guides, YouTube tutorials, nor other sources.
How can I process a JSON array item by item?
Examples:
• I have an array of URLs that I want to crawl one by one.
• JSON arrays containing image prompts are generated from articles, and I want to create images from them.
There are countless use cases where this is necessary.
I can access the first item with
{{get myJsonVariable “$.items[0].name”}}
(or by changing the number to access a different item), but I can’t seem to use a variable for that number.
for example: {{get myJsonVariable “$.items[{{counter}}].name”}}
this wont work.
Does anyone have any ideas for me?
Thank you so much.
Hi @mefrankyt,
It sounds like the Run Workflow block is the best fit for your use case.
Here are a couple of examples you can remix into your workspace to explore how they’re structured:
Simple : https://app.mindstudio.ai/agents/run-workflow-simple--remix-46a2a888/remix
Advanced : https://app.mindstudio.ai/agents/run-workflow-advanced--remix-f3bfba48/remix
The key difference between them:
- The Simple version uses an Iterator to process individual items
- The Advanced version works with a structured JSON array
Since you’re already working with a JSON array, the Advanced version will likely be the better fit. You’ll just need to change the Execution Mode to Sequential.
Hope this helps!
Perfect! Thank you ever so much — this makes me so happy. I guess I was overcomplicating it.
This is incredibly helpful!
Thank you again for your help.
Using “Run Workflow” works great for this.
However, I’m facing the same problem again: I want to process a JSON array step by step, but I also want to manually intervene in the process.
Example:
The array contains several last names. I want each of them to be displayed to me one by one, and I want to manually enter the corresponding first names for each last name via an input block.
Sub-workflows seem to have the “problem” that you can neither display content nor use user input blocks within them. Is that correct?
Are there any ways I can solve this?
Thank you very much.