Skip to content

JSON Services (system.json)

This namespace provides services for parsing and manipulating JSON data structures.

Services

system.json:Parse

Parses a JSON string and optionally extracts a specific value.

  • Inputs:
    • json: (string) The raw JSON string.
    • path: (string, optional) Dot-notation path (e.g., user.address.zip).
  • Outputs:
    • parsed: (object) The fully parsed JSON object.
    • value: (any) The value at the specified path.

system.json:Extract

Extracts a value from a pre-parsed structured object (map or slice) using dot notation. This is particularly useful for working with JSON bodies received via the REST API.

  • Inputs:
    • data: (object) The structured object to extract from.
    • path: (string) Dot-notation path (e.g., customer.id).
  • Outputs:
    • value: (any) The value found at the specified path.

system.json:Format

Converts a structured object (map or slice) into a JSON string.

  • Inputs:
    • data: (object) The data to convert.
    • indent: (boolean, optional) Whether to indent the output. Defaults to false.
  • Outputs:
    • json: (string) The formatted JSON string.

Path Syntax

  • Nesting: data.user.id
  • Arrays: items[0].name
  • Dynamic: Combine both results[2].metadata.key

Released under the ISC License.