Skip to content

#toInteger

Returns a value converted to a whole number.

#toInteger(value)
Category Types and conversionValid in Property value
Name Type Description
value path | value The value to convert.

integer

  • Throws when the value can’t be converted. Wrap it in #try to supply a fallback.
source.json
{
"text": "42"
}
transformer.json
{
"result": "#toInteger($.text)"
}
output.json
{
"result": 42
}

Try it in the playground →

#toDecimal · #isInteger · #try