I have a json that comes from InvokeHTTP. I did a Split Json and JoltTransform to get the Key, Values, but I need to change all the Keys from Camelcase to snakecase.
My Keys will be different with every InvokeHttp call. I've tried AttributestoJson and EvaluateJsonPath and some replace text, but haven't figured out a way to dynamically change just the keys and then merge back to the values without writing a custom processor.
Original Data from InvokeHTTP:
{
"data": {
"Table": [
{
"Age": 51,
"FirstName": "Bob",
"LastName": "Doe"
},
{
"Age": 26,
"FirstName": "Ryan",
"LastName": "Doe"
}
]
}
}
Input after Split Json (Gives me each json in a separate flowfile) and Jolt:
[
{
"Key": "Age",
"Value": 51
},
{
"Key": "FirstName",
"Value": "Bob"
},
{
"Key": "LastName",
"Value": "Doe"
}
]
Desired Output:
{
"data": {
"Table": [
{
"age": 51,
"first_name": "Bob",
"last_name": "Doe"
},
{
"age": 26,
"first_name": "Ryan",
"last_name": "Doe"
}
]
}
}