This may get you closer to your desired output:
import json from pandas import json_normalize info = json.loads(resp.json) fileaction = json_normalize(info) fileaction.to_csv(filename, index=False, encoding='utf-8')