maahutch
2 years agoNew Contributor
Reshape document to denormalized table
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:
First | Second |
1 | a |
2 | a |
3 | b |
4 | b |
I'm thinking I need to use the "map" or "mapValue" function but I can't figure out how to do it. Any ideas?
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.
After JSON Splitter you will need to rename the column name because, by default, the snap will return splitValue.
Hope this helps!
BR.
Ivica