Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
public class Foo {
	
    @Consume(uri = "activemq:queue:books.new")
    public void doSomething(@JsonPath("$.store.book[*].author") String author, @Body String json) {
      // process the inbound message here
    }
}

Encoding Detection

Since Camel version 2.16, the encoding of the JSON document is detected automatically, if the document is encoded in unicode  (UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE ) as specified in  RFC-4627. If the encoding is a non-unicode encoding, you can either make sure that you enter the document in String format to the JSONPath component or you can specify the encoding in the header "CamelJsonPathJsonEncoding" (JsonpathConstants.HEADER_JSON_ENCODING).

Dependencies

To use JSonPath in your camel routes you need to add the a dependency on camel-jsonpath which implements the JSonPath language.

...