Skip to content

JSON_DECODE()

Synopsis

Returns the string value of a JSON object key from a string containing a JSON array.

Description

The JSON_DECODE function retrieves the value of the given variable name and parses it as JSON, returning the value at a specified key. If the key cannot be found, an empty string is returned.

Syntax

JSON_DECODE(varname,item[,separator[,options]])
Arguments
  • varname - The name of the variable containing the JSON string to parse.

  • item - The name of the key whose value to return.
    Multiple keys can be listed separated by a hierarchy delimeter, which will recursively index into a nested JSON string to retrieve a specific subkey's value.

  • separator - A single character that delimits a key hierarchy for nested indexing. Default is a period (.)
    This value should not appear in the key or hierarchy of keys itself, except to delimit the hierarchy of keys.

  • options

    • c - For keys that reference a JSON array, return the number of items in the array.
      This option has no effect on any other type of value.

See Also

Generated Version

This documentation was generated from Asterisk branch 21 using version GIT