Parse JSON String Data in n8n
An external webhook sent a property called 'metadata' as a stringified JSON instead of a real object. Parse it.
Incoming Payload / Data:
{
"metadata": "{\"plan\":\"enterprise\",\"seats\":10}"
}
βοΈ Your expression is executed against test data β any correct solution passes. +20 XP
β Solution & explanation
Output: { "plan": "enterprise", "seats": 10 }
JSON.parse() converts that string back into a real object, so you can then read JSON.parse($json.metadata).plan.π‘ Pro tip: If the string might be empty or invalid, run it in a Code node inside try { ... } catch { ... } so one bad record doesn't stop the workflow.