I have the following dictionary
test = {'data': [
{'actions': [
{'action_type': 'link_click', 'value': '16'},
{'action_type': 'post_engagement', 'value': '16'},
{'action_type': 'page_engagement', 'value': '16'}],
'spend': '13.59',
'date_start': '2023-02-07',
'date_stop': '2023-02-07'},
{'actions': [
{'action_type': 'comment', 'value': '5'},
{'action_type': 'onsite_conversion.post_save', 'value': '1'},
{'action_type': 'link_click', 'value': '465'},
{'action_type': 'post', 'value': '1'},
{'action_type': 'post_reaction', 'value': '20'},
{'action_type': 'video_view', 'value': '4462'},
{'action_type': 'post_engagement', 'value': '4954'},
{'action_type': 'page_engagement', 'value': '4954'}],
'spend': '214.71',
'date_start': '2023-02-07',
'date_stop': '2023-02-07'}]}
And I am trying to convert it where each element after action type is a pandas DataFrame column, and the value as row. Something like
link_click post_engagement page_engagement spend comment onsite_conversion ...
16 16 16 13.59 N/A N/A
465 4954 4954 214.71 5 1
I understand that the first list does not have comment, post, etc, and the rows would be N/A. How do I manage this complicated data structure?

json_normalize, then you might need to do a pivot. Or I suppose you could do it manually :| i.e. use Python structures like list comprehensions and such.