Contact Form 7 sends an AJAX request to a REST endpoint. The endpoint must return a clean JSON object. When the response contains any other data, the browser reports an invalid JSON error.
Output contamination is a frequent cause. Any echo, print, var_dump, PHP notice or warning that appears before the JSON payload corrupts the response. The first character of the output becomes HTML, which breaks the JSON parser.
Caching plugins often serve a stored HTML page for the REST URL. They may also inject extra markup into the response. The result is an HTML document instead of JSON.
Security and firewall plugins can block the REST request or prepend an access‑denied message. The request then returns a 403 or 404 page, which the form treats as invalid JSON.
Outdated or broken Contact Form 7 add‑ons hook into the JSON echo filter. They may return malformed data or abort the request. The form never receives the expected success payload.
Incorrect rewrite rules, server‑level compression, mixed HTTP/HTTPS, or wrong site URL settings also prevent the endpoint from delivering proper JSON. The endpoint may return a 500 error or an empty response.