[ 
https://issues.apache.org/jira/browse/CAMEL-20495?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17822126#comment-17822126
 ] 

Rhuan Rocha edited comment on CAMEL-20495 at 2/29/24 1:16 PM:
--------------------------------------------------------------

Sure! 

I have an example running with this change. Look at this example:
{code:java}
// code placeholder
from("direct:start2")
        .split().jsonpath("$.store.books[0]")
        .to("log:book", "mock:result"); {code}
{code:java}
template.sendBody("direct:start", "{\n" + " \"store\": {\n" + " \"books\": [\n" 
+ " {\n" + " \"title\": \"xxx\",\n" + " \"number\": \"0123-4567-8888\"\n" + " 
}\n" + " ]\n" + " }\n" + " \n" + "}");

{code}
In this example, the behavior changes. I tested the 3.12.0 and 3.13.0. 


was (Author: JIRAUSER297305):
Sure! 

I have an example running with this change. Look at this example:
{code:java}
// code placeholder
from("direct:start2")
        .split().jsonpath("$.store.books[0]")
        .to("log:book", "mock:result"); {code}
{code:java}
template.sendBody("direct:start", "{\n" + " \"store\": {\n" + " \"books\": [\n" 
+ " {\n" + " \"title\": \"xxx\",\n" + " \"number\": \"0123-4567-8888\"\n" + " 
}\n" + " ]\n" + " }\n" + " \n" + "}");
{code}

> Allow enable/disable Split EIP split a Map out of the box
> ---------------------------------------------------------
>
>                 Key: CAMEL-20495
>                 URL: https://issues.apache.org/jira/browse/CAMEL-20495
>             Project: Camel
>          Issue Type: Improvement
>          Components: came-core
>            Reporter: Rhuan Rocha
>            Priority: Major
>
> We are supporting the Split EIP splitting a map out of the box from Camel 
> 3.13.0 https://issues.apache.org/jira/browse/CAMEL-17101. However, it changes 
> the behavior when using jsonpath, as the jsonpath always evaluates the 
> message to Map.
> {code:java}
> // code placeholder
> from("direct:start")
>         .split().jsonpath("$.store.books")
>         .to("log:book", "mock:result"); {code}
> My suggestion is to allow enable and disable this behavior. Look at this 
> example
> {code:java}
> // code placeholder
> from("direct:start")
>         .split()
>         .splitMapEntry(true)
>         .jsonpath("$.store.books")
>         .to("log:book", "mock:result"); {code}
>  
> Let me know if it makes sense. If so, I can get this issue and send a PR. 
>  
>  



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

Reply via email to