{"record":{"id":"0cf84e9ec91372be","repo":"apache/beam","slug":"field-type-s-s-not-supported-when-converting-between-json","errorCode":null,"errorMessage":"Field type%s %s not supported when converting between JSON and Rows. Supported types are: %s","messagePattern":"Field type(.+?) (.+?) not supported when converting between JSON and Rows\\. Supported types are: (.+?)","errorType":"validation","errorClass":"UnsupportedRowJsonException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java","lineNumber":117,"sourceCode":"})\npublic class RowJson {\n  private static final ImmutableSet<TypeName> SUPPORTED_TYPES =\n      ImmutableSet.of(\n          BYTE, INT16, INT32, INT64, FLOAT, DOUBLE, BOOLEAN, STRING, DECIMAL, DATETIME, MAP);\n  private static final ImmutableSet<String> KNOWN_LOGICAL_TYPE_IDENTIFIERS =\n      ImmutableSet.of(\n          SqlTypes.DATE.getIdentifier(),\n          SqlTypes.TIME.getIdentifier(),\n          SqlTypes.DATETIME.getIdentifier());\n\n  /**\n   * Throws {@link UnsupportedRowJsonException} if {@code schema} contains an unsupported field\n   * type.\n   */\n  public static void verifySchemaSupported(Schema schema) {\n    ImmutableList<UnsupportedField> unsupportedFields = findUnsupportedFields(schema);\n    if (!unsupportedFields.isEmpty()) {\n      throw new UnsupportedRowJsonException(\n          String.format(\n              \"Field type%s %s not supported when converting between JSON and Rows. Supported types are: %s\",\n              unsupportedFields.size() > 1 ? \"s\" : \"\",\n              unsupportedFields.toString(),\n              SUPPORTED_TYPES.toString()));\n    }\n  }\n\n  private static class UnsupportedField {\n    final String descriptor;\n    final TypeName typeName;\n\n    UnsupportedField(String descriptor, TypeName typeName) {\n      this.descriptor = descriptor;\n      this.typeName = typeName;\n    }\n\n    @Override","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java#L99-L135","documentation":"RowJson.verifySchemaSupported scans a Schema and throws UnsupportedRowJsonException if any field has a type not supported by Beam's Row-to-JSON conversion. The message lists the unsupported fields and the set of supported types. This is a pre-flight validation for JSON serialization of Rows.","triggerScenarios":"Calling RowJson.toJson / creating a RowJson converter for a schema containing an unsupported field type (per SUPPORTED_TYPES), verified via verifySchemaSupported(schema).","commonSituations":"Schemas containing logical types, MAP/ARRAY of unsupported element types, or custom types that have no JSON mapping; schema evolved to add such a field after JSON export was built.","solutions":["Remove or transform unsupported fields (map them to supported types) before JSON conversion.","Check SUPPORTED_TYPES in RowJson to confirm which field types are allowed.","Use a logical type with a supported base type or convert to STRING manually.","Flatten or drop nested unsupported structures before serialization."],"exampleFix":"// before\nRowJson.RowToJsonConverter converter = RowJson.RowToJsonConverter.forSchema(schema); // throws\n// after\nSchema trimmed = schema;\nfor (UnsupportedField f : RowJson.findUnsupportedFields(schema)) {\n  trimmed = Schema.builder().addFields(.../* exclude or remap f */...).build();\n}","handlingStrategy":"validation","validationCode":"try {\n  RowJson.verifySchemaSupported(schema);\n} catch (UnsupportedRowJsonException e) {\n  // remap/drop unsupported fields before building the converter\n}","typeGuard":null,"tryCatchPattern":"try {\n  converter = RowJson.RowToJsonConverter.forSchema(schema);\n} catch (UnsupportedRowJsonException e) {\n  schema = sanitizeSchema(schema); // remove/remap unsupported field types\n  converter = RowJson.RowToJsonConverter.forSchema(schema);\n}","preventionTips":["Run verifySchemaSupported as a startup check for any Row<->JSON path.","Keep schemas limited to types in RowJson.SUPPORTED_TYPES.","Convert logical/custom types to supported base types (e.g. STRING) at ingest.","Add a test asserting schema-to-JSON compatibility on schema changes."],"tags":["java","apache-beam","json","schema","unsupported-type"],"backgroundTag":"unsupported-operation","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"}