JSON Validates however some still give error: JSON parameter need to be an valid JSON

For some items I get an error JSON parameter need to be an valid JSON. However when I validate the JSON on external validators it’s evaluated as valid. When I load the value in the node as fixed I get no error. Many of the Items just work and have no error with the same set-up. I have no indication anything is different for the JSON values that give the error.

What is the error message (if any)?

JSON parameter need to be an valid JSON

Information on your n8n setup

  • n8n version: 1.27.3
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): npm
  • Operating system: linux

After a lot of digging it seems its the \n new lines causing this.

Hi @joschatje
i got it what might be the problem.
for WooCommereceProduct.json
in set node you have its datatype set as string, try changing the datatype in set node, change it to something else.
it will work , if need more help
copy and give me input.

2 Likes

Thanks! This helped

It sounds like there might be specific formatting or encoding issues with the JSON parameters that are causing the error message in your system. Here are some troubleshooting steps you can take:

  1. Check for hidden characters: Sometimes, invisible characters or whitespace can affect the validity of JSON. Make sure there are no hidden characters or extra spaces in your JSON parameters.
  2. Encoding: Ensure that the JSON parameters are encoded correctly. They should be in UTF-8 encoding to be interpreted properly.
  3. Escape characters: Check if there are any special characters in your JSON parameters that need to be escaped properly. Common characters that require escaping include double quotes ("), backslashes (), and certain control characters.
  4. Nested JSON: If your JSON includes nested objects or arrays, ensure that they are structured correctly and all opening and closing brackets are properly matched.
  5. Compare working vs. non-working JSON: Compare the JSON parameters that are causing the error with those that are working fine. Look for any differences in formatting, structure, or content that might be causing the issue.
  6. Debugging tools: Use debugging tools or logging to inspect the JSON parameters at runtime. This can help identify any specific issues or discrepancies that are causing the error.

By carefully reviewing and troubleshooting these aspects of your JSON parameters, you should be able to identify and resolve the error message you’re encountering. If you’re still unable to resolve the issue, consider reaching out to the support team of the system or platform you’re using for further assistance.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.