toBytes

Converts a String to byte[], using the given character set. For example, given a schema such as:


{
  "type": "record",
  "name": "events",
  "fields": [
    { "name": "name", "type": "string" },
    { "name": "s", "type" : "string"}
  ]
}

and a record such as:


{
  "name" : "My Event",
  "s" : "Hello World!"
}

The following record path would convert the String field into a byte array using UTF-16 encoding:

toBytes( /s, "UTF-16")