Search code examples
arraysjsongoogle-cloud-platformgoogle-cloud-dataprep

how to merge rows in google dataprep


I am really struggling with google data prep as there is no much information about this.

lets say i have data:

{"name":"john","age":21,"dob":"1988-01-01","tags":["a","b"],"address":{"postcode":3122,"state":"vic"},"lineItems":[{"itemID":"item001","unitPrice":1000},{"itemID":"item002","unitPrice":2000}]}
{"name":"aom","age":21,"dob":"1988-02-01","tags":["c","d"],"address":{"postcode":3000,"state":"Vic"},"lineItems":[{"itemID":"item003","unitPrice":3000},{"itemID":"item004","unitPrice":4000}]}

then my next step was to flatten the array into rows in order to clean the data. In this case, it will create 4 rows in total.

Now, I don't know how to merge rows based on name for example.

The function of merge is only to merge columns.


Solution

  • A (workaround) solution that I was able to come up with is to introduce a constant column using "derive" and then to pivot.

    Pivot details