{"record":{"id":"70a4ea406abc1ab3","repo":"apache/beam","slug":"field-name-is-not-present-in-the-json-object","errorCode":null,"errorMessage":"Field '{name}' is not present in the JSON object.","messagePattern":"Field '(.+?)' is not present in the JSON object\\.","errorType":"validation","errorClass":"UnsupportedRowJsonException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java","lineNumber":285,"sourceCode":"    @Override\n    public Row deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)\n        throws IOException {\n\n      // Parse and convert the root object to Row as if it's a nested field with name 'root'\n      return (Row)\n          extractJsonNodeValue(\n              FieldValue.of(\"root\", FieldType.row(schema), jsonParser.readValueAsTree()));\n    }\n\n    private Object extractJsonNodeValue(FieldValue fieldValue) {\n      if (fieldValue.type().getNullable()) {\n        if (!fieldValue.isJsonValuePresent()) {\n          switch (this.nullBehavior) {\n            case ACCEPT_MISSING_OR_NULL:\n            case REQUIRE_MISSING:\n              return null;\n            case REQUIRE_NULL:\n              throw new UnsupportedRowJsonException(\n                  \"Field '\" + fieldValue.name() + \"' is not present in the JSON object.\");\n          }\n        }\n\n        if (fieldValue.isJsonNull()) {\n          switch (this.nullBehavior) {\n            case ACCEPT_MISSING_OR_NULL:\n            case REQUIRE_NULL:\n              return null;\n            case REQUIRE_MISSING:\n              throw new UnsupportedRowJsonException(\n                  \"Field '\" + fieldValue.name() + \"' has a null value in the JSON object.\");\n          }\n        }\n      } else {\n        // field is not nullable\n        if (!fieldValue.isJsonValuePresent()) {\n          throw new UnsupportedRowJsonException(","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java#L267-L303","documentation":"RowJson's field extractor throws UnsupportedRowJsonException when the nullBehavior is REQUIRE_NULL but the field is entirely absent from the JSON object (not even present as null). This enforces a strict contract that fields declared non-nullable in the schema must be explicitly present in the JSON. It is raised in extractJsonNodeValue during deserialization.","triggerScenarios":"Deserializing JSON with RowJson configured with nullBehavior=REQUIRE_NULL while a schema field is missing from the JSON object (isJsonValuePresent false).","commonSituations":"Producer omits optional keys; JSON schema evolved so older messages lack a new field; strict null behavior (REQUIRE_NULL/REQUIRE_MISSING) selected for lenient producers.","solutions":["Switch RowJson nullBehavior to ACCEPT_MISSING_OR_NULL if missing fields are acceptable.","Fix the producer to always emit the field, or emit null explicitly.","Wrap the JSON with defaults before deserialization (set missing keys to null)."],"exampleFix":"// before\nRowJson.JsonToRowConverter c = RowJson.JsonToRowConverter.forSchema(schema,\n    RowJson.RowJsonBuilder... nullBehavior(REQUIRE_NULL));\n// after\n... nullBehavior(ACCEPT_MISSING_OR_NULL);","handlingStrategy":"try-catch","validationCode":"ObjectNode copy = json.deepCopy();\nschema.getFieldNames().forEach(n ->\n    copy.withArray(n) /* ensure key exists, set null if missing */);\n// or simply choose a lenient nullBehavior before converting","typeGuard":null,"tryCatchPattern":"try {\n  Row row = jsonToRow.convert(json);\n} catch (UnsupportedRowJsonException e) {\n  LOG.warn(\"Missing field in JSON: {}\", e.getMessage());\n  row = convertWithLenientNullBehavior(json); // ACCEPT_MISSING_OR_NULL\n}","preventionTips":["Match nullBehavior strictness to what the producer actually emits.","Prefer ACCEPT_MISSING_OR_NULL for externally produced JSON.","Contract-test producer output against the schema's nullability.","Ensure producers emit explicit nulls (not omitted keys) when REQUIRE_NULL is used."],"tags":["java","apache-beam","json","deserialization","null-handling"],"backgroundTag":"missing-required-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}