{"record":{"id":"71dcc8324fb85082","repo":"apache/seatunnel","slug":"json-operation-failed","errorCode":"JSON_OPERATION_FAILED","errorMessage":"Object json deserialization exception.","messagePattern":"Object json deserialization exception\\.","errorType":"error_code","errorClass":"EasysearchConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/serialize/EasysearchRowSerializer.java","lineNumber":108,"sourceCode":"                        .append(objectMapper.writeValueAsString(document))\n                        .append(\", \\\"doc_as_upsert\\\" : true }\")\n                        .toString();\n            } else {\n                Map<String, String> indexMetadata = createMetadata(row);\n                /**\n                 * format example: { \"index\" : {\"_index\" : \"${your_index}\", \"_id\" :\n                 * \"${your_document_id}\"} }\\n ${your_document_json}\n                 */\n                return new StringBuilder()\n                        .append(\"{ \\\"index\\\" :\")\n                        .append(objectMapper.writeValueAsString(indexMetadata))\n                        .append(\"}\")\n                        .append(\"\\n\")\n                        .append(objectMapper.writeValueAsString(document))\n                        .toString();\n            }\n        } catch (JsonProcessingException e) {\n            throw new EasysearchConnectorException(\n                    JSON_OPERATION_FAILED, \"Object json deserialization exception.\", e);\n        }\n    }\n\n    private String serializeDelete(SeaTunnelRow row) {\n        String key = keyExtractor.apply(row);\n        Map<String, String> deleteMetadata = createMetadata(row, key);\n        try {\n            /**\n             * format example: { \"delete\" : {\"_index\" : \"${your_index}\", \"_id\" :\n             * \"${your_document_id}\"} }\n             */\n            return new StringBuilder()\n                    .append(\"{ \\\"delete\\\" :\")\n                    .append(objectMapper.writeValueAsString(deleteMetadata))\n                    .append(\"}\")\n                    .toString();\n        } catch (JsonProcessingException e) {","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/serialize/EasysearchRowSerializer.java#L90-L126","documentation":"serializeUpsert serializes the row key and document with Jackson; a JsonProcessingException (e.g. unserializable object, invalid date format, NaN) is wrapped as JSON_OPERATION_FAILED with the message 'Object json deserialization exception.' (misleadingly worded; it is a serialization failure).","triggerScenarios":"A SeaTunnelRow field value that Jackson cannot serialize to JSON — custom objects, invalid temporal types, cyclic references — during upsert bulk action building.","commonSituations":"Complex/nested types from upstream sources not convertible by the configured ObjectMapper; date/time formats mismatched; MapData/ArrayData handled incorrectly by a custom serializer.","solutions":["Inspect the offending row's field types; convert unsupported types (e.g. Date/BigDecimal) to JSON-friendly values upstream.","Ensure the sink's field-to-document conversion (toDocumentMap) only emits Jackson-serializable values.","Configure the ObjectMapper (date format, FAIL_ON_EMPTY_BEANS) appropriately.","Log the failing row to identify which field breaks serialization."],"exampleFix":"// before\ndocument.put(\"ts\", java.sql.Timestamp value); // may fail\n// after\ndocument.put(\"ts\", timestamp.toInstant().toString());","handlingStrategy":"try-catch","validationCode":"objectMapper.writeValueAsString(document); // dry-run serialization before writing","typeGuard":"boolean jsonSafe(Object v) { try { objectMapper.writeValueAsString(v); return true; } catch (JsonProcessingException e) { return false; } }","tryCatchPattern":"try { serializer.serializeRow(row); } catch (EasysearchConnectorException e) { log row contents; dead-letter row; }","preventionTips":["Ensure all field values are Jackson-serializable","Convert Date/BigDecimal to JSON-friendly types upstream","Log failing rows to identify offending fields"],"tags":["easysearch","jackson","json","serialization"],"backgroundTag":"json-marshal-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}