Articles in this section

jsonSerialize helper

The jsonSerialize helper converts an object or array into a JSON-formatted string. Use it when you need to pass an entire record or a subset of fields as a JSON payload -- for example, as the body of an HTTP request or for logging purposes.

Syntax

{{{jsonSerialize objectToSerialize}}}

objectToSerialize -- The object or array to serialize. Required. If you pass a string, it is wrapped in quotes rather than serialized as an object.

Note: Always use triple braces ({{{ }}}). Double braces cause Celigo to apply additional formatting to the JSON output, which may corrupt the string for downstream systems.

Examples

Serialize the entire record

{{{jsonSerialize record}}}

Returns the full record object as a JSON string, ready to use as a request body or stored value.

Serialize a nested array

{{{jsonSerialize record.items}}}

Input: record.items is an array of order items
Output:

[{"sku":"ITEM001","quantity":2},{"sku":"ITEM002","quantity":1}]

Usage notes

  • Always use triple braces ({{{ }}}). Double braces apply additional formatting that may corrupt the JSON string.
  • If you pass a string rather than an object or array, the output is a quoted string (e.g. "my string"), not a serialized object.
  • To parse a JSON string back into an object for property access or iteration, use the jsonParse helper instead.