I need to parse it and apply a function on the innerHTML attribute.
Each innerBlock can have multiple blocks and of course, there is no limit to levels.
In PHP, I would use a recursive function but I have some trouble to imagine how I can achieve that with N8N.
What I need at the end is the new value of post_content to udpate it with a webhook.
Thanks for your help !
That’s the first part of the workflow, for the recursive part :
This one gives me this error :
Missing node to start execution
Please make sure the workflow you're calling contains an Execute Workflow Trigger node
One important thing, the process I will apply on each innerHTML will be handled by AI. So I will have to wait for their reply.
In any case, the most important thing is that the order at the beginning of the workflow will have to be the same as the end.
I thought about making 2 different workflow, the first one calling the second one, as I would in PHP, but I don’t see how I could recombine the array at the end
This code node will convert it to arrays so that you can iterate the items.
it only handles one input, so it can only do one parent post at a time. Let me know if that needs to be different
So then the default behavior of the output of this will run nodes for as many items are in the array. So if you prompt an ai node to change content, then it will chance each one.
I guess you’ll probably have to convert it back, but it is much easier to work with as an array
The hardest part from here will be making sure you edit all of the nested content as well. That will be a little tricky. I can help you with that later if you have questions
I’ve made some progress but I’m a bit lost. I’ve tried your workflow and made some advancement also with split.
That’s my 2 workflows here :
The first one is the main loop and the sconde one the recursive one.
Problem, the loop only loop on the first item then stops. And even more strange, the second receive an empty array.
I know I’m doing something wrong but I don’t understand what
I don’t understand how I could recombine my array at the end of the process …
I’ve changed the workflow to avoid the recursive part and only make it on 3 levels. But I don’t get how to recombine my data at the end
In this first json, I need to modify the innerHTML and innerContent.
If anyone has some exemples of accessing and modifying arrays in arrays, and return the exact same array format with the new values that would be awesome !
Thanks a lot
This is a tough one. Since you split up a tree into separate streams it is very hard to bring them back in the same order again. At least I assume that the relations matter in the output as well.
What if you convert the object into a plain text with placeholders, send it through translation in one peace and then turn that to a proper object again?
Thanks for your reply.
The relation matters a lot, it’s a blog post
The problem is the particularity of the data format (I don’t have the hand on it). The innerHTML and innerCONTENT fields are the same content but one is an array of one element and the other not.
If I translate it, the 2 values have a risk to be different
That’s why I was looking for kind of a recursive worklfow or something similar but I guess it’s going to be hard to find.