I need to convert all values of country to Title case like "Russia".
[
{
"name": "Mehari",
"country": "russia",
"age": 50
},
{
"name": "Helen",
"country": "Norway",
"age": 20
},
{
"name": "Abdu",
"country": "India",
"age": 30
}
]
What I did
[
{
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"country": "=toTitleCase(@(1,&))"
}
}
}
]
Output: no change.
[
{
"name": "Mehari",
"country": "russia",
"age": 50
},
{
"name": "Helen",
"country": "Norway",
"age": 20
},
{
"name": "Abdu",
"country": "India",
"age": 30
}
]
I think the following JOLT spec can work in your case:
[{
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"country": "=split('',@(1,&))"
}
}
}, {
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"country": {
"[0]": "=toUpper(@(0))"
}
}
}
}, {
"operation": "modify-overwrite-beta",
"spec": {
"*": {
"country": "=join('',@0)"
}
}
}]