apache/seatunnel · error · RuntimeException
Json parse object exception.
Error message
Json parse object exception.
What it means
JsonUtils.parseObject(String, JavaType/TypeReference) is the generic-typed variant of parseObject that binds JSON to an arbitrary Jackson type. Failures are wrapped in this RuntimeException (note the trailing period distinguishing it from error 172).
Source
Thrown at seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/JsonUtils.java:249
}
/**
* json to object
*
* @param json json string
* @param type type reference
* @param <T> type
* @return return parse object
*/
public static <T> T parseObject(String json, TypeReference<T> type) {
if (StringUtils.isEmpty(json)) {
return null;
}
try {
return OBJECT_MAPPER.readValue(json, type);
} catch (Exception e) {
throw new RuntimeException("Json parse object exception.", e);
}
}
/**
* object to json string
*
* @param object object
* @return json string
*/
public static String toJsonString(Object object) {
try {
return OBJECT_MAPPER.writeValueAsString(object);
} catch (Exception e) {
throw new RuntimeException("Object json deserialization exception.", e);
}
}
public static ObjectNode parseObject(String text) {View on GitHub (pinned to cf67b549a7)
Solutions
- Check the chained cause to distinguish syntax errors from binding errors
- Verify the JavaType/TypeReference matches the actual JSON shape including generics
- If the JSON is a plain array/scalar, use toList or parseArray instead
- Log the offending JSON (truncate if large) alongside the exception to debug
Example fix
// before
Map<String, List<Integer>> r = JsonUtils.parseObject(json, new TypeReference<Map<String, List<String>>>() {}); // wrong value type
// after
Map<String, List<Integer>> r = JsonUtils.parseObject(json, new TypeReference<Map<String, List<Integer>>>() {}); Defensive patterns
Strategy: try-catch
Try / catch
try {
Result r = JsonUtils.parseObject(json, new TypeReference<Result>() {});
} catch (RuntimeException e) {
log.error("typed parse failed, cause={}", e.getCause());
throw new IllegalArgumentException("json does not match expected type", e);
} Prevention
- Double-check TypeReference generics match the real JSON structure
- Log the raw payload (truncated) when typed parsing fails
- Pin the JSON schema of external APIs and test against samples on upgrades
When it happens
Trigger: Calling JsonUtils.parseObject(json, type) where json is malformed, or cannot be bound to the supplied JavaType/TypeReference (wrong nesting, incompatible field types).
Common situations: Parsing deeply generic payloads (Map<String,List<Foo>>) built with TypeReference, API responses that changed shape, key/value type erasure mistakes when constructing the JavaType.
Understand the failure class
Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.
Related errors
- Json parse object exception!
- Json parse list exception!
- json to map exception!
- String json deserialization exception.<content>
- Json deserialization exception.
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/5088d885b56849f7.
Report an issue: GitHub.