{ \"abc\": null, \"def\": 9 }
I have JSON data which looks like this. If not for null (without quotes as a string), I could have used ast
ast
One solution is to use a variable that contains None.
import json null = None data = { "test": null } json.dumps(data)