Category: Forms and APIs

HTTP 400: Unexpected token while parsing JSON

Read this guide in Polish

Endpoint rejects the request before saving the form and the console shows JSON error.

How to identify the source of the problem

Check the actual body, correct commas and characters incorrectly escapated by the customer.

Save method, status, headers and anonymized body requests and answers.

Repair steps

Use JSON.stringify instead of gluing text and handle invalid JSON controlled 400.

How to Test Solution

The correct object passes and the incorrect syntax does not run the write operation.

Security and restrictions

Do not disable authorization or validation of webhook signature for status 200. Wash the tokens in the logs.