quarkusio/quarkus · error · IllegalArgumentException
Unknown JSON Value {kind}
Error message
Unknown JSON Value {kind} What it means
VertxJson converts jakarta.json values into Vert.x JsonObject/JsonArray by recursively copying entries. Its copy switch handles NULL, TRUE, FALSE, STRING, NUMBER, and OBJECT kinds; if a jakarta.json value has another kind (i.e. ARRAY appearing in the object-entry copy path, or any future/unexpected kind), it throws IllegalArgumentException "Unknown JSON Value <kind>". This indicates a conversion gap, typically when a jakarta.json array is nested inside a JsonObject being converted to a Vert.x JsonObject.
Source
Thrown at extensions/resteasy-reactive/rest-jsonb-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jsonb/common/runtime/serialisers/VertxJson.java:66
JsonNumber number = origin.getJsonNumber(key);
if (number.isIntegral()) {
object.put(key, number.longValue());
} else {
object.put(key, number.doubleValue());
}
break;
case ARRAY:
JsonArray array = new JsonArray();
copy(array, origin.getJsonArray(key));
object.put(key, array);
break;
case OBJECT:
JsonObject json = new JsonObject();
copy(json, origin.getJsonObject(key));
object.put(key, json);
break;
default:
throw new IllegalArgumentException("Unknown JSON Value " + kind);
}
});
}
public static void copy(JsonArray array, jakarta.json.JsonArray origin) {
for (int i = 0; i < origin.size(); i++) {
JsonValue value = origin.get(i);
JsonValue.ValueType kind = value.getValueType();
switch (kind) {
case STRING:
array.add(origin.getString(i));
break;
case TRUE:
array.add(true);
break;
case FALSE:
array.add(false);
break;View on GitHub (pinned to e1c734241f)
Solutions
- Avoid nesting jakarta.json.JsonArray inside a jakarta.json JsonObject passed to VertxJson; build the structure directly as Vert.x JsonObject/JsonArray
- Convert with jakarta.json's own toString()/reader and parse into Vert.x types (new JsonObject(jsonString)) instead of using VertxJson.copy
- Upgrade Quarkus — check if a fixed version handles ARRAY in this copy path; if not, file a bug with a reproducer
- Flatten the payload so object entries are only scalars, nulls, booleans, or nested objects before conversion
Example fix
// before
JsonObject origin = Json.createObjectBuilder().add("tags", Json.createArrayBuilder().add("a")).build();
VertxJson.copy(vertxObject, origin); // throws: Unknown JSON Value ARRAY
// after
io.vertx.core.json.JsonObject v = new io.vertx.core.json.JsonObject(origin.toString()); Defensive patterns
Strategy: try-catch
Validate before calling
static void assertNoNestedArrays(jakarta.json.JsonObject o) {
for (String k : o.keySet()) {
if (o.get(k) instanceof jakarta.json.JsonArray)
throw new IllegalArgumentException("Nested jakarta.json arrays are unsupported by VertxJson.copy: " + k);
}
} Type guard
static boolean isVertxCopySafe(jakarta.json.JsonValue v) {
if (v instanceof jakarta.json.JsonObject o)
return o.values().stream().noneMatch(x -> x instanceof jakarta.json.JsonArray);
return !(v instanceof jakarta.json.JsonArray);
} Try / catch
try {
VertxJson.copy(target, origin);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Unknown JSON Value")) {
io.vertx.core.json.JsonObject fallback = new io.vertx.core.json.JsonObject(origin.toString());
}
} Prevention
- Prefer building Vert.x JsonObject/JsonArray directly when both JSON stacks are in play
- Round-trip via JSON string (origin.toString() -> new JsonObject(...)) for mixed Json-P/Vert.x payloads
- Avoid nesting jakarta.json.JsonArray inside objects passed to VertxJson
- Add a conversion unit test covering nested arrays
When it happens
Trigger: Calling the VertxJson serializer/converter on a jakarta.json JsonObject that contains a nested jakarta.json.JsonArray value (the object-copy switch lacks an ARRAY case), producing the error at runtime during request body reading/writing.
Common situations: Using jakarta.json (Json-P) structures with JSON-B/RESTEasy Reactive JSON-B endpoints where nested arrays exist inside objects; differences between Json-P and Vert.x JSON APIs when bridging both JSON stacks in one app; building payloads with Json.createObjectBuilder().add("list", arrayBuilder).
Related errors
- Unknown JSON Value ${kind}
- Cannot create JsonArray
- Cannot create JsonObject
- Unknown JSON Value
- Failed to encode as JSON:
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/b7786921f39c56e6.
Report an issue: GitHub.