camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "skyswind@gmail.com" <skysw...@gmail.com>
Subject Re: How to get a specific value from a json string?
Date Thu, 02 May 2013 09:25:38 GMT
Hi

Thank you for the help!

1.For the json-path library, can you give me some blueprint using example?

2. I have covert the json into a map struction using jackson with the
following code

<route>
<from uri="jms:queue:FEATURES.JSON"/>
<unmarshal>
 <json library="Jackson"/>
</unmarshal>
 <to uri="jms:queue:FEATURES.JSON3"/>
</route>

How can I get the value of "id" field? Can you give me some example?

Thank you again!

黄骞/Huang Qian
超图分布式地理信息研究室主任/ Director of SuperMap Distributed GIS Lab
超图GIS研究所高级研究员/ Senior Researcher at SuperMap GIS Institute
地址:北京市朝阳区酒仙桥北路甲10号电子城IT产业园201楼E门4层,100015
Add: 4/F Unit E, Building 201, No. A10, Jiuxianqiaobei Road, Chaoyang
District, Beijing, 100015, CHINA
电话/Tel:+86-10- 010-59896522
传真/Fax:+86-10-59896666
手机/Mobile:15901268883
电子邮件/Mail: huangqian@supermap.com
网址/Website: http://www.supermap.com.cn


On Thu, May 2, 2013 at 4:25 PM, Claus Ibsen <claus.ibsen@gmail.com> wrote:

> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message