binary()

Encodes a string into a byte array using utf-8 or specified charset.

Syntax

binary(STR_EXPR[, CHARSET])
Required Parameters
STR_EXPR
Target string expression to be converted to binary
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 blob=binary("hello, world!") => 68656c6c6f2c20776f726c6421
json "{}" | eval blob=binary(null) => null