I loaded a JSON file through json.load(file) and edited it.
I want to send a requests with json=payload that has some null values. But, after loading it in python, it became "None".
My question is how do I keeping null and without converting to "None" to send the requests.
Example:
Before json.loads()
{
"key1": 10,
"key2": "Comes and Goes",
"key3": null,
"key4": null,
"key5": null,
"key6": []
}
After json.load()
{
"key1": 10,
"key2": "Comes and Goes",
"key3": None,
"key4": None,
"key5": None,
"key6": []
}
But what I really want after json.load() is:
{
"key1": 10,
"key2": "Comes and Goes",
"key3": null,
"key4": null,
"key5": null,
"key6": []
}
Any help is appreciatted! Thanks in advance.
json.loads()shouldn't ever translatenullto"None"; it should only translate it toNonewithout the quotes, which is how Python writes the value that JavaScript callsnull. Can you show the specific code you're using to invokeloads(), so we can cause this problem ourselves?