[Haskell-cafe] "Flatten" JSON objects under toListOf
Stuart Popejoy
spopejoy at panix.com
Tue Nov 25 04:41:41 UTC 2014
Hi,
I'd like to transform some JSON to "flatten" objects in a list to a
single dimension. Say I have:
[{ "Name": "Stuart", "Dimensions": { "H": 71, "W": 170 } },
{ "Name": "Sam", "Dimensions": { "H": 72, "W": 180 } }]
How do I get it to just
[{ "Name": "Stuart", "W": 170 } },
{ "Name": "Sam", "W": 180 } }]
I've tried zipWith with various toListOf constructions to pick apart and
rebuild a new JSON object. Is there a better way?
Thanks,
Stuart
More information about the Haskell-Cafe
mailing list