Some common syntax errors that cause this response are missing comma, extra trailing comma, incorrect quotation marks, mismatched brackets, and encoding issues.
This error indicates that the request has content type application/json, but the request body could not be parsed as JSON.
Some common syntax errors that cause this response are:
{% code-block language="json" %}
{
"name": "John"
"age": 30
}
{% end-code-block %}
There should be a comma between the two key-value pairs.
{% code-block language="json" %}
{
"name": "John"
"age": 30,
}
{% end-code-block %}
The trailing comma after the last key-value pair should be removed.
{% code-block language="json" %}
{
'name': 'John',
"age": 30,
}
{% end-code-block %}
JSON requires double quotes (") for string values and property names, not single quotes.
{% code-block language="json" %}
{
"name": "John",
"age": 30,
"nicknames": [ "Johnny", "Jimbo"
}
{% end-code-block %}
The array brackets are not properly closed.
For example, sending UTF-16-encoding JSON data in the body, but using a Content-Type: application/json; charset=utf-8
header that specifies a different encoding could cause JSON data to fail parsing.