apache camel spring dsl check if body contains string

Sergii Getman picture Sergii Getman · Nov 28, 2014 · Viewed 10k times · Source

I am trying to check :

<simple>${body} contains 'verification'</simple>

Body is the json:

{"verification": {"email": "[email protected]", "code": "1234"}}

But this condition doesn't work. I've tried as well:

<simple>${body} contains &#39;verification&#39;</simple>
<simple>${bodyAs(String)} contains 'verification'</simple>
<simple>${body.verification} != null</simple>

Could you please suggest me something?

Answer

Claus Ibsen picture Claus Ibsen · Nov 28, 2014

I guess the body is maybe not a String, then try with

<simple>${bodyAs(String)} contains 'verification'</simple>

And btw what version of Camel do you use?