GET Request and JSON to Table

Hi guys,

I have a JSON file that looks like this:

[
     {
          "id":"0001",
          "idBoard":"0001",
     },
     {
          "id":"0002",
          "idBoard":"0001",
     },
     {
          "id":"0003",
          "idBoard":"0001",
     }
]

When I connect it to the JSON to Table node, it puts everything on the same row. However, I need it to be in the following form:

id, idBoard
0001,0001
0002,0001
0003,0001

What do I need to do here?

Hi,

I’ve build a small example and attached it.

First of all, the commas after “idBoard”:"…" have to be removed so that it’s valid. Next we take a JSON to Table Node and create a table. The settings of this node are important in this case:
Under Arrays we select ‘Expand to columns (max generate many)’. Next under ‘Children Expansion’ we set ‘Only up to level 1’.
These settings allows you to split up your original JSON column into three JSON columns (for each row one). Afterwards the Transpose Node is used to transpose these columns into rows. Then again, the JSON to Table Node is used with its default settings and the end result is your needed table.

Cheers,
Moritz

JSON_EXAMPLE.knwf (5.5 KB)

4 Likes

Hey, Moritz, thank you for helping me out. I ended up working on it too and came up with a similar solution but I think yours is simpler. I am attaching mine to share. I used a loop to solve the problem.

The reason why I asked for help with this is that I thought that there is a particular configuration for the JSON to Table node that could achieve that in one step. Apparently, several steps are required just as I concluded.

Thank you again.JSON_EXAMPLE - 2.knwf (7.4 KB)

1 Like

Thanks that you also shared your solution.
My first intuition was the same. But there is also a good reason why it is this way, as you take more control on how the JSON column shall be represented in a table.

Cheers,
Moritz

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.