[ARTEMIS-3607]: Supporting JsonValues in JsonUtil.addToArray and

JsonUtil.addToObject

* When the added Object is of type JsonValue, don't call the toString
  method on it.

Issue: https://issues.apache.org/jira/browse/ARTEMIS-3607
This commit is contained in:
Emmanuel Hugonnet 2021-12-15 09:01:15 +01:00 committed by clebertsuconic
parent e34677f5c0
commit dd645d0d4e
1 changed files with 4 additions and 0 deletions

View File

@ -173,6 +173,8 @@ public final class JsonUtil {
addToArray(parameter, objectArrayBuilder);
}
jsonObjectBuilder.add(key, objectArrayBuilder);
} else if (param instanceof JsonValue) {
jsonObjectBuilder.add(key, (JsonValue)param);
} else {
jsonObjectBuilder.add(key, param.toString());
}
@ -218,6 +220,8 @@ public final class JsonUtil {
addToArray(parameter, objectArrayBuilder);
}
jsonArrayBuilder.add(objectArrayBuilder);
} else if (param instanceof JsonValue) {
jsonArrayBuilder.add((JsonValue)param);
} else {
jsonArrayBuilder.add(param.toString());
}