n8n LabBeginner
Set a Default Value with ?? in n8n
Some leads don't share a phone number. Write 'N/A' into your sheet instead of leaving it blank.
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:
{
"phone": null
}
$json.phone
βοΈ Your expression is executed against test data β any correct solution passes. +10 XP
β Solution & explanation
$json.phone ?? 'N/A'
Output: N/A
a ?? b returns b only when a is null or undefined. || also replaces empty strings, 0 and false β use it when those should count as missing too.π‘ Pro tip: For a number like 0 items, ?? keeps 0 while || would wrongly replace it.
Also accepted: || 'N/A'
π ?? (nullish coalescing) reference: syntax & more examples →