the error is because you have extra opening bracket between dict and row.
if you need to get different json as body - construct the list of dicts
if you need to get different json as body - construct the list of dicts
import json rows = [(1, "Apple"), (2, "Banana"), (3, "Orange")] json_rows = [dict(zip(('Id', 'Fruit'), (str(key), value))) for key, value in rows] print(json.dumps(json_rows))
Output:[{"Id": "1", "Fruit": "Apple"}, {"Id": "2", "Fruit": "Banana"}, {"Id": "3", "Fruit": "Orange"}]
>>>
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs