Which Python value will result in null in the output of json.dumps()?

Viewed 18

Everything I have searched for seems to be about handling null returns, when in this case I want to output an actual null without double quotes:

input_data['field1'] = "foo"
input_data['field2'] = "null"  # what to put here to get output below?
output_json = json.dumps(input_data)

This results in:

{"field1": "foo", "field2": "null"}

Here's what I want to get:

{"field1": "foo", "field2": null}

with no double quotes around the null. How do I do this?

0 Answers
Related