JSON Converter#
The JSON Converter allows to convert a configuration value into a JsonObject
or JsonArray
.
The following dependency is required in the classpath to use the JSON Converter:
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-converter-json</artifactId>
<version>3.5.4</version>
</dependency>
JsonObject
or JsonArray
are automatically converted from their String
value.
@Inject
@ConfigProperty(name = "someJsonArray")
private JsonArray someValue;
@Inject
@ConfigProperty(name = "someJsonObject")
private JsonObject someValue;
The value of the configuration properties must be valid JSON, or a JsonParsingException
is thrown.