Jackson JQ support
See original GitHub issueDescription
This extension aims to add jq expressions to a Quarkus application. It’s backed by jackson-jq library. The extension is already done. I need to migrate it to the Quarkiverse format. You can see the code here: https://github.com/ricardozanini/jackson-jq/pull/1/files
Configuration suggestion
The usage is pretty straightforward, won’t require any additional properties for now.
Additional context
Users will have the Scope
bean available for injection. Scope
is the entry point of Jackson JQ library, as demonstrated in their examples of usage:
Here’s a simple use case. A REST endpoint that’s capable of executing a jq
expression and return its output:
@Path("/parser")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class ParserResource {
@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;
}
public static class Document {
private String expression;
private JsonNode document;
public JsonNode getDocument() {
return document;
}
public void setDocument(JsonNode document) {
this.document = document;
}
public String getExpression() {
return expression;
}
public void setExpression(String expression) {
this.expression = expression;
}
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
eiiches/jackson-jq: jq for Jackson Java JSON Processor - GitHub
To test a query quickly, we provide jackson-jq CLI. Please note that jackson-jq is a Java library and the CLI is provided solely...
Read more >JQ - Apache Camel
Since Camel 3.18. Camel supports JQ to allow using Expression or Predicate on JSON messages. ... Camel JQ leverages camel-jackson for type conversion....
Read more >Jackson-JQ: Running jq commands from java - Stack Overflow
Asking for help, clarification, or responding to other answers. · Making statements based on opinion; back them up with references or personal ...
Read more >JsonQuery (net.thisptr:jackson-jq 0.0.7 API) - Javadoc.io
Class JsonQuery · Constructor Summary · Method Summary · Methods inherited from class java.lang.Object · Constructor Detail · Method Detail ...
Read more >jq Manual (development version)
jq supports the same set of datatypes as JSON - numbers, strings, booleans, arrays, objects (which in JSON-speak are hashes with only string...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
cc @gastaldi
Thanks, guys! I’ll start tweaking the code and will open the PR ASAP.