On 2023-01-20, Dino <d...@no.spam.ar> wrote: > > let's say I have this list of nested dicts: > > [ > { "some_key": {'a':1, 'b':2}}, > { "some_other_key": {'a':3, 'b':4}} > ] > > I need to turn this into: > > [ > { "value": "some_key", 'a':1, 'b':2}, > { "value": "some_other_key", 'a':3, 'b':4} > ]
[{"value": key, **value} for d in input_data for key, value in d.items()] -- https://mail.python.org/mailman/listinfo/python-list