We need to evaluate JSON object expressions in java.
We have the following source JSON object
{
"a": 100,
"b": 200,
"c": 300,
"d": "calc(a+c)",
"f": {
"g": 100,
"h": 200,
"i": "calc(g+h)"
}
}
we need output this format
{
"a": 100,
"b": 200,
"c": 300,
"d": 400,
"f": {
"g": 100,
"h": 200,
"i": 300
}
}
We tried
we tried https://github.com/octomix/josson but that is more of a filtering JSON.
2
Answers
Hope this helps. All the necessary information is mentioned inside the code itself.
Output
For unknown structure
This solution assumes
()
f
in this example)Transformation
Suggest to group all the expressions in a pre-defined array
Output