String conversion functions
Strings can be converted to various data types by using the
as construct. In particular, this construct allows converting JSON or YAML strings into (Java™) objects.
| Syntax | Description | Example |
|---|---|---|
<string> as number [ using locale <locale> [ and <format> ] | using <format> ] |
Converts a string to a number. | "1 000 000,0" as number using "#,##0.0" |
"1 000 000,0" as number using locale "fr_FR" and
"#,##0.0" |
||
<string> as boolean |
Converts a string to a Boolean. | "TRUE" as boolean |
<string> as date & time [ using locale <locale> and <format>
] |
Converts a string to a date or time. See Dates and Times for more information about supported type formats. | "2025/01/08" as date & time using locale "fr_FR" and
"yyyy-MM-dd'T'HH:mm:ss.SSSZ" |
<string> as <EnumType> |
Converts a string to an enumeration type. Either the JSON name or the data type name of the enumeration type can be used. | "May" as month |
<string> as <DataModelType>
using <Format> |
Converts a string to a type available in your data model by using the specified format (for example, JSON, YAML). | "{ \"r\": 255, \"g\": 255, \"b\":255 }" as color using JSON |
"{ \"name\": \"John\" }" as customer using JSON |