I have switched to orjson since it is faster, but this has caused an issue I have had for a fair amount of time now but never thought anything of it. I finally decided to do tests and these were my tests.
import orjson, json
data = json.dumps({"channel_id" : None, "payment_source_id" : None})
print(data)
data = orjson.dumps({"channel_id" : None, "payment_source_id" : None}).decode("utf-8")
print(data)
{"channel_id": null, "payment_source_id": null}
{"channel_id":null,"payment_source_id":null}
This is my testing file. When you run this you see that the only difference is the space between null and the quotes. When I try to dump json data using orjson and send it in a request , I get a 400 bad request and sometimes nothing back at all, but when trying with the json lib everything works fine, I get a valid response back. I’m not sure what to do because like I said the only difference is the spaces. Has anyone had a similar issue and can tell me what’s happening or what Im doing wrong? Also another thing to note is that if there is no “None” in my code orjson works fine.