Articles in this section

jsonSerialize helper

Use jsonSerialize to convert any object or array into a JSON-formatted string in Celigo. This is especially handy when you need to pass an entire record or a subset of fields as JSON—such as creating a JSON payload for an HTTP request. The syntax is typically {{{jsonSerialize yourObject}}} to ensure raw, unformatted output.

Usage

{{{jsonSerialize objectToSerialize}}}

Examples

  1. Serializing the entire record

    {{{jsonSerialize record}}}
    

    This example returns a JSON string of the entire record object, which could then be stored in another system or used as part of a request body.

  2. Serializing nested fields

    {{{jsonSerialize record.items}}}
    

    If record.items is an array of order items, this returns something like:

    [{"sku":"ITEM001","quantity":2},{"sku":"ITEM002","quantity":1}]
    
  3. Double vs. Triple Braces

    {{jsonSerialize record}}
    

    Using double braces here may introduce additional formatting (for example, quoting) depending on the context. If you want the raw JSON with no additional processing, use triple braces as shown above.

Tip

  • Always confirm the data you pass to jsonSerialize is an actual object or array. If you pass a string, it will be wrapped in quotes, which might not be what you intend.

  • Triple braces ({{{ }}}) are recommended if you need raw JSON output for downstream systems or logging.

  • Test with realistic data to ensure the JSON-serialized string meets your use-case requirements—especially if your downstream system expects a specific JSON structure.