MALFORMED_JSON_DOCUMENT
MALFORMED_JSON_DOCUMENT
Description
The document part of the request is declared as application/json, but the context cannot compute its canonical form (RFC 8785). The fingerprint of a JSON document is the SHA-256 of this canonical form: the order of the keys and the white space have no effect.
HTTP Status
422 Unprocessable Entity
doc_url Format
The doc_url value is an absolute URL and changes by environment:
<docs-base-url>/errors/malformed_json_document
Typical Causes
- The document does not parse as JSON: for example, it is cut, or it has a trailing comma or a comment.
- The document is not valid UTF-8.
- A string holds a lone surrogate (
"\ud800"). - A number is out of the range of a double (
1e400).
Example
Request: POST /v1/certification/certifications with a document part declared application/json that holds {"consent":.
Response:
json
{
"errors": [
{
"code": "MALFORMED_JSON_DOCUMENT",
"message": "The document is declared as application/json, but it is not a valid JSON document",
"doc_url": "https://docs.example.com/errors/malformed_json_document"
}
]
}How To Fix
- Check that the document parses as JSON (RFC 8259) and is encoded in UTF-8.
- Send the request again with a new idempotency key.
- If the document is not JSON, send it with the declared type
text/plain.