n8n LabBeginner
Convert an Object to a JSON String in n8n
An API expects a 'metadata' field that contains JSON as a string, not as an object.
Live Execution Simulator
Idle
π₯
Incoming Data
βοΈ
n8n Node
π―
Next Step
> Ready. Type your expression below and click "Check Answer" to run the node.
Incoming Payload / Data:
{
"payload": { "plan": "pro", "seats": 5 }
}
βοΈ Your expression is executed against test data β any correct solution passes. +10 XP
β Solution & explanation
JSON.stringify($json.payload)
Output: "{\"plan\":\"pro\",\"seats\":5}"
JSON.stringify() turns an object into text. It's the reverse of JSON.parse().π‘ Pro tip: Pretty-print for Slack or email: JSON.stringify($json.payload, null, 2).