Open lolpez opened 4 years ago
I have an API which returns as response '{}' when a method DELETE worked.
'{}'
However when using the option json: true, I get the following error: '400 - {"err":"Invalid json","ECODE":"JSON_001"}'
json: true
'400 - {"err":"Invalid json","ECODE":"JSON_001"}'
The option is supposed to parse the response body as JSON so I should get an empty object as response {}.
{}
I believe when JSON parsing '{}' returns {} which is valid.
Why is this happening?
What you have here is actually not related to the response but instead you get a 400 status code from your API. That means that the JSON in your request is wrong. Please double check your data variable.
data
I have an API which returns as response
'{}'
when a method DELETE worked.However when using the option
json: true
, I get the following error:'400 - {"err":"Invalid json","ECODE":"JSON_001"}'
The option is supposed to parse the response body as JSON so I should get an empty object as response
{}
.I believe when JSON parsing
'{}'
returns{}
which is valid.Why is this happening?