jq
is a very popular JSON processor.
Jackson JQ is an implementation of this processor in Java, and now you can
integrate it in your Quarkus application!
Simply add the dependency to your Quarkus project:
<dependency>
<groupId>io.quarkiverse.jackson-jq</groupId>
<artifactId>quarkus-jackson-jq</artifactId>
</dependency>
Then you can simply use the jackson-jq
's
Scope
bean in
your services. For example:
@Path("/jackson-jq")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class JacksonJqResource {
@Inject
Scope scope;
@POST
public List<JsonNode> parse(Document document) throws JsonQueryException {
final JsonQuery query = JsonQuery.compile(document.expression, Versions.JQ_1_6);
List<JsonNode> out = new ArrayList<>();
query.apply(this.scope, document.document, out::add);
return out;
}
}
Underneath, this extension uses jackson-jq
, so the
same limitations and capabilities
of that library also applies here.
If you encounter any bugs or have any questions, please feel free to open an issue.
Thanks goes to these wonderful people (emoji key):
Ricardo Zanini 💻 🚧 |
This project follows the all-contributors specification. Contributions of any kind welcome!