I guess you should do something a like http://camel.apache.org/jsonpath
.when().jsonpath("$.op == 'i'") On Mon, Nov 24, 2014 at 5:36 PM, gmh <gordon...@gmail.com> wrote: > All, > In my sample code I am reading a json file and doing a jsonpath to do > content based routing. > > Here is the simple route > from("file:src/data2/test.json?noop=true") > .choice() > > .when(PredicateBuilder.isEqualTo(ExpressionBuilder.languageExpression("jsonpath", > "$.op"), ExpressionBuilder.constantExpression("i"))) > > .log("UK message") > .to("file:target/messages2/insert") > .otherwise() > .log("Other message") > .to("file:target/messages2/others"); > > The file contains the following json file > { > "ts": Timestamp(1415124334, 1), > "op": "i", > "ns": "test.products", > "o": { > "_id": ObjectId("5459156e7950e8c18c094992"), > "item": "card", > "qty": 15 > } > } > > > The route has started according to the log but jsonpath does not work > What is wrong with my syntax? > Gordon > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/how-to-read-json-in-a-file-and-use-jsonpath-tp5759546.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/