cancel
Showing results for 
Search instead for 
Did you mean: 

Reshape document to denormalized table

maahutch
New Contributor

I have a document like this: 

[
  {
    "first": ["1", "2"],
    "second": "a"
   },
  {
    "first": ["3", "4"],
    "second": "b"
  } 
]

 And I'm trying to convert it to a table like this: 

FirstSecond
1a
2a
3b
4b

I'm thinking I need to use the "map" or "mapValue" function but I can't figure out how to do it. Any ideas? 

1 ACCEPTED SOLUTION

ivicakoteski
New Contributor III

Hi @maahutch ,

You can use the JSON Splitter snap. You will need to split the $first and add the $second as an included path.
Include paths allow you to include objects from the input document in the resulting output document.

ivicakoteski_0-1693554542140.png

After JSON Splitter you will need to rename the column name because, by default, the snap will return splitValue.

Hope this helps!
BR.
Ivica

 



View solution in original post

1 REPLY 1

ivicakoteski
New Contributor III

Hi @maahutch ,

You can use the JSON Splitter snap. You will need to split the $first and add the $second as an included path.
Include paths allow you to include objects from the input document in the resulting output document.

ivicakoteski_0-1693554542140.png

After JSON Splitter you will need to rename the column name because, by default, the snap will return splitValue.

Hope this helps!
BR.
Ivica