Skip to content
Advertisement

parse json object in django view

I have a form than i need to check if the emails on my form are valid or not here is my ajax code :

JavaScript

and this is my code in django view:

JavaScript

it raises this error : TypeError: the JSON object must be str, bytes or bytearray, not ‘NoneType’ thanks in advance

Advertisement

Answer

TypeError: the JSON object must be str, bytes or bytearray, not ‘NoneType’

As the error says, the object that json.loads is trying to parse is somehow None, you would need figure out why the object is null, set a breakpoint in the validate function or print the value of request.POST to check what data is available on the server

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement