Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4169B1072C for ; Thu, 2 May 2013 08:26:32 +0000 (UTC) Received: (qmail 46731 invoked by uid 500); 2 May 2013 08:26:31 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 46454 invoked by uid 500); 2 May 2013 08:26:31 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 46444 invoked by uid 99); 2 May 2013 08:26:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 May 2013 08:26:31 +0000 X-ASF-Spam-Status: No, hits=0.3 required=5.0 tests=FREEMAIL_REPLY,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.210.182 as permitted sender) Received: from [209.85.210.182] (HELO mail-ia0-f182.google.com) (209.85.210.182) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 May 2013 08:26:27 +0000 Received: by mail-ia0-f182.google.com with SMTP id x30so275302iaa.13 for ; Thu, 02 May 2013 01:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=1eFYNK55swbe6sHb+1Yp2kGNSklQtBENFBTX/Ks1IH8=; b=WKgtoEF9DzLP67+20L5DOEBpidnooGZW50A8wwiCE7JAXpXnL6/mMc0S4aZxNJAbGW nu9/B13esrHPDQK2qOgvF2AqQ/4V/Z8ZzwWIBTzsVcDOpi/MAzJLDw9u/yDpGK2aLsKE c8FcbHWW6yNsRsCr54cNPsrx6pWJjBqCtfs3SevAe+O/cIOwYj7ZbypcV+1dST2QRJZA Dh8yJcRbhXq+CPfxsxoY/FzKiZN/MX6Iwhi2kp1za0KDWrtNGO0xAvGpqK7WsXMSO2vr zlZpfHogVtXftXZ7wk1XQrUtc7s/IqO7uz8iuQlfOY/9ROCR3aMNWJutDizn5lkpXyNj qxIg== X-Received: by 10.50.65.69 with SMTP id v5mr7135578igs.39.1367483167215; Thu, 02 May 2013 01:26:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.53.232 with HTTP; Thu, 2 May 2013 01:25:47 -0700 (PDT) In-Reply-To: References: From: Claus Ibsen Date: Thu, 2 May 2013 10:25:47 +0200 Message-ID: Subject: Re: How to get a specific value from a json string? To: "users@camel.apache.org" , skyswind@gmail.com Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org 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 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? > > > > some code here > > > > 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