Resolving JSON errors in automation workflows is crucial for maintaining reliable operations, particularly when dealing with dynamic data sources and API integrations. This guide demonstrates practical solutions for common JSON-related issues such as “Bad Request body,” “Validate input JSON,” and “Unprocessable Entity” errors within Make.com automations.
Understanding how to properly format and escape JSON data can save hours of troubleshooting time and ensure your automations run smoothly without interruption.
In my recent video, I demonstrate several effective methods for handling JSON errors and provide practical solutions for common scenarios:
Understanding JSON Validation
One of the most straightforward approaches to identifying JSON errors is using a JSON validator like JSONLint. These tools can quickly identify hidden characters and formatting issues that might not be visible to the naked eye, helping to resolve “validate input JSON” errors commonly encountered in Apify actors and similar modules.
Handling Dynamic Data
When working with dynamic data from sources like Google Sheets or Airtable, special characters can often break JSON structures. This is particularly common when dealing with generated text from services like OpenAI or Cloud AI, where quotation marks and other special characters may interfere with the JSON structure.
JSON Escaping Formula
To handle special characters effectively, you can use this escaping formula in Make.com:
{{replace(replace(replace(replace(replace(replace(replace(YOUR_DATA; "/\n/g"; space); "/\r/g"; space); "/\t/g"; space); "/\f/g"; space); "/\//g"; "/"); "/\\/g"; "\\"); "/""/g"; "\"")}}
Implementation Tips
When implementing these solutions, simply replace “YOUR_DATA” in the formula with your dynamic field reference. The formula automatically handles the escaping of special characters, ensuring your JSON remains valid regardless of the input data’s content.
Additional Resources
For more complex scenarios involving multiple JSON lines or advanced automation needs, the AI Automators community provides access to comprehensive templates, courses, and live workshop support to enhance your automation capabilities.