Skip to main content

Description

Serializes a value to a JSON string. Handles various data types including objects, arrays, strings, numbers, booleans, and null.

Syntax

Parameters

Returns

Type: string A JSON string representation of the value. Returns null if serialization fails or if the input is undefined.

Examples

Example 1: Serialize a Map

Output:

Example 2: Serialize a List

Output:

Example 3: Preparing Data for Export

Example 4: Storing JSON in Properties

Notes

  • Returns null if serialization fails (e.g., circular references)
  • undefined values are normalized to null
  • Dates are serialized in ISO format
  • Functions and symbols cannot be serialized and will cause null return
  • Useful for API responses, data export, or storing complex structures

See Also

Frequently Asked Questions

It handles maps, lists, strings, numbers, booleans, and null. It returns null for unsupported types like functions or circular references.
null values are serialized as JSON null. undefined values are normalized to null before serialization.