Articles in this section

jsonEncode helper

The jsonEncode helper outputs a string field value without surrounding quotes. Use it when a downstream system expects a bare string value rather than a quoted one. For numbers and booleans, the literal value is returned unchanged. Objects and arrays are not serialized -- they return "[object Object]".

Syntax

{{jsonEncode field}}

field -- The value to encode. Required. Behavior varies by type:

Input type Output
String The string value without surrounding quotes
Number The literal numeric value
Boolean The literal boolean value
Object or array [object Object]

Examples

Output a string field without quotes

{{jsonEncode record.email}}

Input: record.email is "jane.doe@example.com"
Output: jane.doe@example.com

The output has no surrounding quotes, unlike a standard {{record.email}} expression.

Pass a numeric field

{{jsonEncode record.total}}

Input: record.total is 89.99
Output: 89.99

Pass an object

{{jsonEncode record}}

Input: record is { "customerId": "CUST123" }
Output: [object Object]

Objects are not serialized to JSON. Use the jsonSerialize helper if you need a valid JSON string representation of an object or array.

Usage notes

  • Double braces and triple braces produce the same output for jsonEncode -- the helper removes quotes by design.
  • Do not use jsonEncode for objects or arrays. Use jsonSerialize helper for true JSON serialization.