I have a JSON input :
{
"levelOne": [
{
"leveltwo": {
"levelThree": [
{
"type": "typeOne",
"leveltwo": {
"Id": "101000094794",
"Id2": "101000013207"
}
},
{
"type": "typeTwo",
"leveltwo": {
"Id": "101000013207",
"Id2": "101000013207"
}
}
]
}
}
]
}
Is there a jolt spec that would lowercase every key, including keys in nested objects? (in this case what is under leveltwo)
{
"levelone": [
{
"leveltwo": {
"levelThree": [
{
"id": "101000094794",
"id2": "101000013207",
"type": "typeOne"
},
{
"id": "101000013207",
"id2": "101000013207",
"type": "typeTwo"
}
]
}
}
]
}
Currently, I'm using following spec (jolt template):`
[
{
"operation": "shift",
"spec": {
"levelOne": {
"*": {
"leveltwo": {
"id": "&3[&2].leveltwo.id",
"levelThree": {
"*": {
"leveltwo": {
"Id": "&6[&5].leveltwo.&3[&2].id",
"Id2": "&6[&5].leveltwo.&3[&2].id2"
},
"type": "&5[&4].leveltwo.&2[&1].type"
}
}
}
}
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"$": "&1.key",
"@": "&1.value"
}
}
},
{
"operation": "modify-overwrite-beta",
"spec": {
"levelOne": {
"key": "=toLower"
}
}
},
{
"operation": "shift",
"spec": {
"*": {
"value": "@(1,key)"
}
}
}
]
Expected result (key should be in lower levelThree, typeOne, typeTwo):
{
"levelone": [
{
"leveltwo": {
"levelthree": [
{
"id": "101000094794",
"id2": "101000013207",
"type": "typeone"
},
{
"id": "101000013207",
"id2": "101000013207",
"type": "typetwo"
}
]
}
}
]
}
Thanks!