decode()

Converts a binary value to a string based on the specified encoding.

Syntax

decode(BLOB_EXPR[, CHARSET])
Required Parameters
BLOB_EXPR
Expression that returns a binary value. The function returns null if a non-binary value is received.
Optional Parameters
CHARSET
Character set (default: utf-8). Use the preferred MIME name or aliases registered in the IANA Charset. https://www.iana.org/assignments/character-sets/character-sets.xhtml

Usage

json "{}" 
| eval encoded=encode("hello, world!"),
     decoded=decode(encoded)
  => encoded: 68656c6c6f2c20776f726c6421 # Binary
  => decoded: "hello, world!" # String