You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/11/28 13:05:00 UTC

[jira] [Created] (CAMEL-18768) camel-jq - Make it easier to grab elements in a template like fashion

Claus Ibsen created CAMEL-18768:
-----------------------------------

             Summary: camel-jq - Make it easier to grab elements in a template like fashion
                 Key: CAMEL-18768
                 URL: https://issues.apache.org/jira/browse/CAMEL-18768
             Project: Camel
          Issue Type: Improvement
          Components: camel-jq
            Reporter: Claus Ibsen
             Fix For: 3.x


If you have a json document where you need to grab a few elemenets, and then output this in another json or csv, or plain text, it would be nice to be able to grab them easly in a template script,

For example the beer-source to get brand and name, you can do
{code}
        from("kamelet:beer-source")
            .setHeader("name")
                .jq(".name")
            .setHeader("brand")
                .jq(".brand")
            .log("${header.brand} - ${header.name}");
{code}

But would be nice to do something ala:

.setBody().template("jq", "Brand of beer: .jq.brand and the name is .jq.name")





--
This message was sent by Atlassian Jira
(v8.20.10#820010)