Unnesting a json file with a recursive loop - how to handle multiple branches ?


I’m trying to create a component using only regular Knime nodes (I’ve used python before to do that, but I’d prefer to have a more user-friendly solution at hand for other users who don’t necessarily code), to unnest any json file into a series of distinct tables, in order to recreate automatically the underlying relational schema structuring the data.

The solution would, of course, be a recursive function. So far, I have tried using a recursive loop, and, it works, but only if each leaf contains just one nested branch (a structure like this : 1->1.1->1.1.1->

If I have got more than one (let’s say 1.1 points to a list of objects 1.1.1, but also another list of unrelated objects 1.1.2), I would have to use the equivalent of a for loop to call the function recursively, but it seems the way loops work in Knime doesn’t allow to do that… I just can’t start a column list loop and then directly point it to the recursive loop end’s first port, as there would be no loop end for it.

Any ideas on how to proceed ?

1 Like

Hi @mpranchere

do you maybe have an example JSON File? Than I could try to recreate this…

Also what would be your output? Because a JSON can be more than a matrix.
If you need only a table, you can use the JSON to Table

Cheers, Iris

1 Like