{"record":{"id":"1e26dfcc19ad2191","repo":"apache/beam","slug":"unable-to-parse-json-object-jsonstring","errorCode":null,"errorMessage":"Unable to parse json object: {jsonString}","messagePattern":"Unable to parse json object: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJsonUtils.java","lineNumber":140,"sourceCode":"  }\n\n  public static ObjectMapper newObjectMapperWith(RowJson.RowJsonSerializer serializer) {\n    SimpleModule module = new SimpleModule(\"rowSerializationModule\");\n    module.addSerializer(Row.class, serializer);\n\n    ObjectMapper objectMapper = new ObjectMapper(createJsonFactory(MAX_STRING_LENGTH));\n    objectMapper.registerModule(module);\n\n    return objectMapper;\n  }\n\n  public static Row jsonToRow(ObjectMapper objectMapper, String jsonString) {\n    try {\n      return objectMapper.readValue(jsonString, Row.class);\n    } catch (JsonParseException | JsonMappingException jsonException) {\n      throw new UnsupportedRowJsonException(\"Unable to parse Row\", jsonException);\n    } catch (IOException e) {\n      throw new IllegalArgumentException(\"Unable to parse json object: \" + jsonString, e);\n    }\n  }\n\n  public static String rowToJson(ObjectMapper objectMapper, Row row) {\n    try {\n      return objectMapper.writeValueAsString(row);\n    } catch (JsonProcessingException e) {\n      throw new IllegalArgumentException(\"Unable to serialize row: \" + row, e);\n    }\n  }\n}\n","sourceCodeStart":122,"sourceCodeEnd":152,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJsonUtils.java#L122-L152","documentation":"jsonToRow wraps remaining IOExceptions (not Json parse/mapping ones) into IllegalArgumentException('Unable to parse json object: <string>'). These are lower-level I/O problems while reading/parsing the JSON string that Jackson did not classify as JSON syntax/mapping errors.","triggerScenarios":"jsonToRow where objectMapper.readValue throws a plain IOException - rare with String input, e.g. low-level decoding issues or an unexpected IOException from a custom ObjectMapper/input source.","commonSituations":"Custom ObjectMappers with unusual input handling; charset/encoding problems; misdiagnosed IO failures from wrapped readers.","solutions":["Read the wrapped cause for the root IO problem","Ensure the input is a well-formed String and the ObjectMapper is a plain Jackson instance (or RowJson-default)","Validate the JSON string separately before calling jsonToRow","Catch IllegalArgumentException distinctly from UnsupportedRowJsonException"],"exampleFix":"try {\n  Row row = RowJsonUtils.jsonToRow(mapper, json);\n} catch (IllegalArgumentException e) {\n  LOG.error(\"Bad json input: {}\", e.getMessage(), e.getCause());\n}","handlingStrategy":"try-catch","validationCode":"if (jsonString == null || jsonString.isEmpty()) throw new IllegalArgumentException(\"Empty json input\");","typeGuard":null,"tryCatchPattern":"try { Row r = RowJsonUtils.jsonToRow(mapper, json); } catch (IllegalArgumentException e) { /* IO-level problem: log e.getCause() and raw input */ }","preventionTips":["Use the standard RowJson ObjectMapper","Sanity-check encoding/charset of inputs","Distinguish IO failures from schema failures via exception type"],"tags":["beam","json","io","deserialization"],"backgroundTag":"json-parse-error","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}