question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jackson JQ support

See original GitHub issue

Description

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:closed
  • Created 2 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
geoandcommented, Oct 1, 2021
1reaction
ricardozaninicommented, Oct 1, 2021

Thanks, guys! I’ll start tweaking the code and will open the PR ASAP.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found