+ private void updateJsonNode(SvcLogicContext ctx, ObjectMapper objectMapper, ObjectNode jsonNode, String key) {
+ if (key.startsWith(Constants.OUTPUT_PAYLOAD + ".")) {
+ String objkey = key.replaceFirst(Constants.OUTPUT_PAYLOAD + ".", "");
+ if (objkey.contains("[") && objkey.contains("]")) {
+ ArrayNode arrayNode;
+ String arrayKey = objkey.substring(0, objkey.indexOf('['));
+ int arrayIndex = Integer
+ .parseInt(objkey.substring(objkey.indexOf('[') + 1, objkey.indexOf(']')));
+ if (jsonNode.has(arrayKey)) {
+ arrayNode = (ArrayNode) jsonNode.get(arrayKey);
+ arrayNode.insert(arrayIndex, ctx.getAttribute(key));
+ } else {
+ arrayNode = objectMapper.createArrayNode();
+ arrayNode.insert(arrayIndex, ctx.getAttribute(key));
+ jsonNode.put(arrayKey, arrayNode);
+ }
+ } else {
+ jsonNode.put(objkey, ctx.getAttribute(key));
+ }
+ }
+ }
+