camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: How to get a specific value from a json string?
Date Thu, 02 May 2013 08:25:47 GMT
Hi

Yeah I would like to see a json expression language built-in out of
the box in Camel.

This library seems compelling
https://code.google.com/p/json-path/

You can also find some talks about json expression libraries here
http://stackoverflow.com/questions/4849816/is-there-a-java-implementation-of-jsonpath

Though you can use the Camel json data format (jackson, gson etc)
http://camel.apache.org/data-format.html

And turn the data into a Map structure, and then get the value from
the map afterwards. For that you can use simple, mvel, ognl languages
to grab the field.

Though I would like that json-path library out of the box as you can
then do a single expression to grab the field.
Though it may only work for expressions. Would be nice for predicates
as well, so you can use it in content based routers / filters etc.







On Thu, May 2, 2013 at 10:12 AM, skyswind@gmail.com <skyswind@gmail.com> wrote:
> Hi everyone,
>
> I came across a simple problem and I need some help.
>
> I get a json string from a jms, and I want to get a specific value from the
> json string.
> how can I do it in blueprint file?
>
> For example, the json from jms queue "FEATURES.JSON" is
>
>  {id:"123",
> name:"test",
> value:"dfsa"}
>
> I want to get the name and pass it to the queue "RETURN"
>
> how can I achieve it?
>
>  <from uri="jms:queue:FEATURES.JSON" />
>
> some  code here
>
>  <to uri="jms:queue:RETURN"/>
>
> Thank you!



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message