=intSum=doubleSum=toString=toInteger=toLong=toDouble=toBoolean-
=size, '=sort' =join=substring-
=abs,=avg,=min, '=max'
These functions work only inside modify-overwrite-beta or modify-default-beta operations.
1. JOLT Modify Operations Overview
There are two modify operations:
1. modify-overwrite-beta
- Replaces the existing value
- Can use functions (
=intSum,=multiply, etc.) - Used for math/string/date transformations
2. modify-default-beta
- Only sets value if missing
- Good for default initialization
How to use functions?
Syntax:
"fieldName": "=functionName(arg1, arg2, ...)"
Arguments can be:
- Literal values
- JSON values referenced via
@(n,key) - Other function outputs
--------------------------------------
2. MATH FUNCTIONS
--------------------------------------
2.1 =intSum, =doubleSum
Add multiple numbers.
Input
{
"price": 100,
"tax": 15
}
Spec
[
{
"operation": "modify-overwrite-beta",
"spec": {
"total": "=intSum(@(1,price), @(1,tax))"
}
}
]
Output
{
"price": 100,
"tax": 15,
"total": 115
}
2.2 =abs
Input
{
"num": -12.7
}
Spec
[
{
"operation": "modify-overwrite-beta",
"spec": {
"absVal": "=abs(@(1,num))",
}
}
]
Output
{
"num": -12.7,
"absVal": 12.7,
}
--------------------------------------
3. STRING FUNCTIONS
--------------------------------------
3.1 =toString
Input
{
"id": 42
}
Spec
[
{
"operation": "modify-overwrite-beta",
"spec": {
"idString": "=toString(@(1,id))"
}
}
]
Output
{
"id": 42,
"idString": "42"
}
3.2 =join (concatenate strings)
Input
{
"first": "John",
"last": "Wick"
}
Spec
[
{
"operation": "modify-overwrite-beta",
"spec": {
"fullName": "=join(' ', @(1,first), @(1,last))"
}
}
]
Output
{
"first": "John",
"last": "Wick",
"fullName": "John Wick"
}
3.3 =substring
Syntax:
"field": "=substring(value, startIndex, endIndex)"
Input
{
"code": "ABCDEF"
}
Spec
[
{
"operation": "modify-overwrite-beta",
"spec": {
"sub": "=substring(@(1,code), 1, 4)"
}
}
]
Output
{
"code": "ABCDEF",
"sub": "BCD"
}
--------------------------------------
4. TYPE CASTING FUNCTIONS
--------------------------------------
=toInteger, =toLong, =toDouble, =toBoolean
Input
{
"price": "100",
"pi": "3.14",
"flag": "true"
}
Spec
[
{
"operation": "modify-overwrite-beta",
"spec": {
"priceInt": "=toInteger(@(1,price))",
"piDouble": "=toDouble(@(1,pi))",
"flagBool": "=toBoolean(@(1,flag))"
}
}
]
Output
{
"price": "100",
"pi": "3.14",
"flag": "true",
"priceInt": 100,
"piDouble": 3.14,
"flagBool": true
}
--------------------------------------
5. ARRAY FUNCTIONS
--------------------------------------
=size()
Input
{
"items": ["a", "b", "c"]
}
Spec
[
{
"operation": "modify-overwrite-beta",
"spec": {
"count": "=size(@(1,items))"
}
}
]
Output
{
"items": ["a", "b", "c"],
"count": 3
}
=sort()
Input
{
"items": [5, 3, 2, 4]
}
Spec
[
{
"operation": "modify-overwrite-beta",
"spec": {
"sorted": "=sort(@(1,items))"
}
}
]
Output
{
"items": [5, 3, 2, 4]
"sorted": [2,3,4,5]
}
--------------------------------------
6. CHAINING MULTIPLE FUNCTIONS
--------------------------------------
Example:
Take a string "100", convert to int, add tax, then format as text.
Input
{
"value": "100"
}
Spec
[
{
"operation": "modify-overwrite-beta",
"spec": {
"final": "=join(' USD', intSum(toInteger(@(1,value)), 15))"
}
}
]
Output
{
"value": "100",
"final": "115 USD"
}
--------------------------------------
7. MASTER LIST — All JOLT Functions
--------------------------------------
Math
=abs
=avg
=min
=max
=intSum
=doubleSum
String
=join
=toString
=substring
Casting
=toInteger
=toLong
=toDouble
=toBoolean
Array
=size
=sort
Top comments (0)