Hi Zixuan Li ,
Thankyou for using Microsoft Q&A platform and thanks for posting your question here.
As per my understanding , you want to transform the json data using mapping dataflow. Please let me know if that is not the case.
To achieve the desired result, you just need a flatten transformation and an aggregate transformation.
- First of all, in source transformation , select document form as 'array of documents' under json settings in source option.
- Now, use a flatten transformation to convert the json data into tabular format
- Use aggregate transformation to group by 'id' and in aggregates tab, create two columns 'itemNames' :
collectUnique(items)
and 'itemOwners':collectUnique(owners)
- Now load the data using sink transformation in json file.
Look at the output file:
Hope it helps. Please accept the answer if it's helpful. Thankyou