J'ai un tableau JSON comme ceci:Aplatir JSON basé sur un attribut - python
[
{
'id': 1,
'values': [
{
'cat_key': 'ck1'
},
{
'cat_key': 'ck2'
}
]
},
{
'id': 2,
'values': [
{
'cat_key': ck3
}
]
}
]
Je veux aplatir ce tableau sur le terrain values
tel que:
[
{
'id': 1,
'cat_key': 'ck1'
},
{
'id': 1,
'cat_key': 'ck2'
},
{
'id': 2,
'cat_key': 'ck3'
}
]
Quel est le plus moyen efficace de le faire en python?