I am attempting to convert the following dict
into JSON using json.dumps
:
{
\'post_engaged\': 36,
\'post_impressions\':
I know this is an old question and it already has an accepted answer, but alas the accepted answer is just totally wrong.
The real issue here is that the code that generates the dict uses the builtin id
function as key instead of the literal string "id"
. So the simple, obvious and only correct solution is to fix this bug at the source : check the code that generates the dict, and replace id
with "id"
.