@ruchitvijay
Is this:
{
“name”:{“abc”, “cde”, “def”},
“organization”:{“xyz”, “pqr”, “null”},
“city”:{“pune”, “mumbai”, “nashik”},
country:{“null”, “null”, “india”}
}
really your desired data? These objects are invalid since there is not key/value pair. Instead it seems those should be lists like this:
{
“name”:[“abc”, “cde”, “def”],
“organization”:[“xyz”, “pqr”],
“city”:[“pune”, “mumbai”, “nashik”],
country:[“india”]
}
assuming that you are okay with lists, I’ve attached an example pipeline with a json generator mocking your given data, and a mapper that produces the results given above.
Basic idea to the approach taken was to zip the key/value pair together, then to reduce the array of pairs into the desired document with a simple ternary operator to see if a concat operation was needed or this was the first time this key was seen then insert a new array.
CommunityExpression_2019_10_21.slp (4.3 KB)