Use jsonEncode to produce a string output without surrounding quotes if you pass in a string field. This helper is designed primarily for string fields and will return the same literal value for non-string inputs (e.g., numbers, booleans)—but will convert objects or arrays to "[object Object]" rather than JSON. If you need true JSON serialization of objects or arrays, consider jsonSerialize.
{{jsonEncode field}}
-
field can be a string, number, boolean, or other type. If it’s not a string, the literal value is returned. Objects/arrays become
"[object Object]".
{{jsonEncode field}}
-
field can be a string, number, boolean, or other type. If it’s not a string, the literal value is returned. Objects/arrays become
"[object Object]".
-
Encoding a string field
{{jsonEncode record.email}}-
If
record.emailis"jane.doe@example.com", the output isjane.doe@example.com(notice no quotes).
-
-
Passing a numeric field
{{jsonEncode record.total}}-
If
record.totalis89.99, the output is89.99.
-
-
Passing an object
{{jsonEncode record}}-
If
recordis{ "customerId": "CUST123" }, the output is"[object Object]"rather than valid JSON.
-
Tip
-
Use
jsonEncodeonly when you specifically want a string field without extra quotes; be cautious when passing objects or arrays. -
If your downstream system requires fully structured JSON for objects, use a helper that preserves JSON structure rather than returning
"[object Object]". -
Double braces vs. triple braces typically do not affect
jsonEncodeoutput—this helper removes quotes around strings by design.