I'm trying to remove the first 3 characters (they are always gonna be the same) from a JSON
Example
{
"hotelnumber" : "1234",
"hotel_code" : "HTL2233658"
}
and I want to get this (removing the "HTL")
{
"hotelnumber" : "1234",
"hotel_code" : "2233658"
}
I'd try a replace and a substring but no luck with it. Thanks in advance
Try this logic :
[
{
"operation": "modify-overwrite-beta",
"spec": {
"count": "=size(@(1,hotel_code))"
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"hotel_code": "=substring(@(1,hotel_code),3,@(1,count))"
}
}, {
"operation": "remove",
"spec": {
"count": ""
}
}
]
In first operation we are calculating size of the field. And in 2nd operation we will substring the field with 3(Since you want to remove first 3 char) till max size. At last we will remove count field.
Hope this resolves your query.