I have a json array like this:
[
{
'id': 1,
'values': [
{
'cat_key': 'ck1'
},
{
'cat_key': 'ck2'
}
]
},
{
'id': 2,
'values': [
{
'cat_key': ck3
}
]
}
]
I want to flatten this array on the field values
such that:
[
{
'id': 1,
'cat_key': 'ck1'
},
{
'id': 1,
'cat_key': 'ck2'
},
{
'id': 2,
'cat_key': 'ck3'
}
]
What is the most efficient way to do this in python?