I use a java delegate and use the getVariable to read the execution variables. Within the execution variables, I have many stringified JSON objects. I loop through all the objects and read create a json node in the following way,
for (String name: execution.getVariableNames()) {
JsonNode data = objectMapper.readTree(execution.getVariable(name).toString());
System.out.println(data);
}
I get all the individual JSON objects from the above for loop.
{"username": "testUser", "company": "TestCompany"}
{"app": "testApp", "subscriberCount": 20000}
{"appCount": 20}
The above is an example of the output I receive. What I would like is to combine the above json objects to a single json objects within the loop. The output should be something like this.
{
"username": "testUser",
"company": "TestCompany",
"app": "testApp",
"subscriberCount": 20000,
"appCount": 20
}
I want to merge all the objects dynamically. Which means I don't want to consider the data that are in the json objects when merging them.