Syntax
GROUPJSONOBJECTMERGE(<string containing JSON Objects>)
Description
Merges all elements in a grouped series of JSON maps.
This is an aggregate function.
Example
Given the following data:
Group | Map |
---|---|
Group1 | {"Andy":"Sales","Alba":Development","Anna":"Marketing","Affa":Management"} |
Group1 | {"Jeff":"Sales","June":"Sales","Jack":"Development"} |
Group2 | {"Sales":"Auto","Development":Auto","Marketing":"Hardware","Management":Auto"} |
Group2 | {"Sales":"Hardware","Sales":Hardware","Development":"Hardware"} |
First create a group using GROUPBY(#RawData!Groups)
GroupBy_Groups |
---|
Group1 |
Group2 |
Then use GROUPJSONOBJECTMERGE(#Sheet1!Map), and the results are the elements of the groups series merged by key.
GroupBy_Groups | Group_Json_Object_Merge |
---|---|
Group1 | {"Andy":"Sales","Alba":Development","Anna":"Marketing","Affa":Management","Jeff":"Sales","June":"Sales","Jack":"Development"} |
Group2 | {"Sales":"Hardware","Development":Hardware","Marketing":"Hardware","Management":"Auto"} |
When JSON Objects with the same key are merged, the earlier key value(s) are overwritten by the following key value(s) in the group.