{"record":{"id":"8dbc9d9a20644b6b","repo":"flowable/flowable-engine","slug":"cannot-convert-value-of-type-value-getclass-t","errorCode":null,"errorMessage":"Cannot convert value of type ${value.getClass()} to Jackson 3 JsonNode","messagePattern":"Cannot convert value of type (.+?) to Jackson 3 JsonNode","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/JsonUtil.java","lineNumber":134,"sourceCode":"                } else if (jackson2JsonNode.isTextual()) {\n                    return StringNode.valueOf(jackson2JsonNode.textValue());\n                } else if (jackson2JsonNode.isNumber()) {\n                    return objectMapper.valueToTree(jackson2JsonNode.numberValue());\n                } else if (jackson2JsonNode.isBoolean()) {\n                    return objectMapper.valueToTree(jackson2JsonNode.booleanValue());\n                } else if (jackson2JsonNode.isMissingNode()) {\n                    return MissingNode.getInstance();\n                }\n\n                String jsonString = jackson2JsonNode.toString();\n                return objectMapper.readTree(jsonString);\n            }\n        }\n        if (allowOtherTypes) {\n            return null;\n        }\n\n        throw new FlowableIllegalArgumentException(\"Cannot convert value of type \" + value.getClass() + \" to Jackson 3 JsonNode\");\n    }\n\n    public static Object deepCopyIfJson(Object value) {\n        if (value instanceof JsonNode jsonNode) {\n            return jsonNode.deepCopy();\n        } else if (JACKSON_2_PRESENT) {\n            if (value instanceof com.fasterxml.jackson.databind.JsonNode jsonNode) {\n                return jsonNode.deepCopy();\n            }\n        }\n\n        return value;\n    }\n\n    public static boolean isArrayNode(Object value) {\n        if (value instanceof ArrayNode) {\n            return true;\n        }","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/util/JsonUtil.java#L116-L152","documentation":"JsonUtil.asJsonNode converts a Java value into a Jackson 3 JsonNode. When the value's type is not convertible (and allowOtherTypes is false, meaning null is not an acceptable outcome), it throws this FlowableIllegalArgumentException naming the offending runtime type.","triggerScenarios":"Passing a non-JSON-convertible object (e.g. an arbitrary POJO, Date, or custom type) to JsonUtil.asJsonNode(value) or to an overload where allowOtherTypes is false and the value is not a JsonNode, primitive wrapper, String, Map, Collection, or similar supported type.","commonSituations":"Variable values stored in process variables (e.g. a Date or custom bean) being converted to JSON for REST/serialization; upgrading from Jackson 2 to Jackson 3 where type support changed; passing untyped Object variables.","solutions":["Check the reported type in the message and convert it to a supported JSON type (String, Number, Boolean, Map, List, JsonNode) before calling asJsonNode.","For POJOs, serialize with an ObjectMapper first (mapper.valueToTree(pojo)) and pass the resulting JsonNode.","Convert java.util.Date/Calendar values to ISO-8601 strings or epoch millis.","If null is acceptable for non-convertible types, use the allowOtherTypes=true variant.","Audit process variables for custom classes that no longer convert under Jackson 3."],"exampleFix":"// before\nJsonNode node = JsonUtil.asJsonNode(myDate);\n// after\nJsonNode node = JsonUtil.asJsonNode(new SimpleDateFormat(\"yyyy-MM-dd'T'HH:mm:ss\").format(myDate));","handlingStrategy":"type-guard","validationCode":"if (value == null || value instanceof JsonNode || value instanceof String || value instanceof Number || value instanceof Boolean || value instanceof Map || value instanceof Collection) {\n    // safe to convert\n}","typeGuard":"static boolean isJsonConvertible(Object v) {\n    return v instanceof JsonNode || v instanceof String || v instanceof Number\n        || v instanceof Boolean || v instanceof Map || v instanceof Collection;\n}","tryCatchPattern":"try {\n    JsonNode node = JsonUtil.asJsonNode(value);\n} catch (FlowableIllegalArgumentException e) {\n    JsonNode node = objectMapper.valueToTree(value); // fallback to full serialization\n}","preventionTips":["Store only JSON-friendly types in process variables","Pre-convert POJOs and dates with an ObjectMapper before JSON conversion","After Jackson 2→3 upgrades, re-test all variable serialization paths"],"tags":["json","jackson","type-mismatch","java"],"backgroundTag":"type-mismatch","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}