public static ObjectNode toJSON(ObjectMapper objectMapper, RecomputeResult success) throws InterruptedException, ExecutionException { final ObjectNode n = objectMapper.createObjectNode(); // write targetID using index reponse final IndexResponse ir = success.indexResponse(); final ObjectNode targetID = objectMapper.createObjectNode(); targetID.put("index", ir.index()); targetID.put("type", ir.type()); targetID.put("id", ir.id()); targetID.put("version", ir.version()); n.put("targetID", targetID); // write dictionary of properties and their values final ObjectNode properties = objectMapper.createObjectNode(); for (Map.Entry<String, JsonNode> entry : success.properties().entrySet()) properties.put(entry.getKey(), entry.getValue()); n.put("properties", properties); // write dictionary of properties and their values n.put("sourceDocumentAfterTransform", success.sourceDocument()); return n; }