Issues sending HTTP

Describe the problem/error/question

I’m generating a JSON to send to an api. When I do it get an error JSON parameter need to be valid JSON. But If I copy the results from my JSON into the JSON to send it works fine.

Using the built JSON doesn’t work, but if I copy and past the results of the built JSON it does? What am I missing?

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

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

Hey @Philip_Wiggins,

Sadly the example workflow fails to run because there is data missing before the code node. It looks like the json parsing we do is failing which would suggest that maybe the JSON isn’t correct.

If you open the expression editor you can select the json in the bottom pane and check it using something like jsonlint.com

1 Like

Sorry I thought the pinned data would move over with the example copy. I have used jsonlint and its a valid json.

Here is the output of code node testdata - Pastebin.com

I did make an update to the workflow I put [] around $json.Records in the Generate Link I noticed on example I hadn’t put it back. But the output/results for the expression give me a valid JSON, but when the HTTP node runs it says its not valid

I had to use the below to get it to work, I did also have to remove the other expression as I don’t have the start node but give this a go.

{  "FileInfoRecords":{{ JSON.stringify($json.Records) }},
   "FileLinkRecord": {
    "litify_docs__Expiration_Date__c": "2023-12-31"
  } 
} 
1 Like

That worked!

2 Likes

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