Open joncooper opened 4 years ago
glom is awesome. Thank you very much for it.
I'm not sure if this is the right place for Q&A but figured I'd give this a shot. If there's a more appropriate place to ask, please let me know and I'll close and move to that venue.
Simplifying a bit, I have data that looks like this:
[ { 'id': 1, 'people': [ { 'type': 'PRIMARY', 'name': {'firstName': 'Alice', lastName': 'Example' } }, { 'type': 'SECONDARY', 'name': {'firstName': 'Bob', 'lastName': 'Example' } } ] }, { 'id': 2, 'people': [ { 'type': 'PRIMARY', 'name': {'firstName': 'Cindy', 'lastName': 'Example' } } ] } ]
I'd like to glom out into the following representation:
[ { 'id': 1, 'primary.firstName': 'Alice', 'primary.lastName': 'Example', 'secondary.firstName': 'Bob', 'secondary.lastName': 'Example' }, { 'id': 2, 'primary.firstName': 'Cindy', 'primary.lastName': 'Example' } ]
It seems to me that this is certainly possible but I haven't been able to figure out how to filter on the value corresponding to the 'type' key.
'type'
Would be grateful for any help figuring this out. I can certainly do it in a less pretty way but I'm sure the glom solution is elegant.
Thanks, Jon
glom is awesome. Thank you very much for it.
I'm not sure if this is the right place for Q&A but figured I'd give this a shot. If there's a more appropriate place to ask, please let me know and I'll close and move to that venue.
Simplifying a bit, I have data that looks like this:
I'd like to glom out into the following representation:
It seems to me that this is certainly possible but I haven't been able to figure out how to filter on the value corresponding to the
'type'
key.Would be grateful for any help figuring this out. I can certainly do it in a less pretty way but I'm sure the glom solution is elegant.
Thanks, Jon