Flattening JSON and creating columns

Hi Easymorphers,

Has anyone had a similar experience to this, and found a better way pivot column values and combine them with the column name of another row, rather than splitting out into a bunch of derived tables, modifying the columns names and jamming them back together?

For example, I want to create the name-Start as a column name with the appropriate value. I feel like there is probably a more slick way in Easymorph to do this in one shot instead of creating a derived table for start,finish,durationdays (assume I care about only these 3 pairings).

Any ideas?

Hi @Perk

It would have been great to give the example file as dset. :slight_smile:
Here is an approach, which might help:

Flattening JSON and creating columns.zip (2.9 KB)

Hi Jochen,

Thank you so much for sharing this method. I knew there would be a different way from my approach that was more efficient. I guess I still have some issues identifying the right circumstances to use unpivot/pivot.

My apologies for not providing a dset and sample .morph file. I will remember to include for next time.

Please have an excellent day!

Best-

1 Like