This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.0.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.0.x by this push:
new 20ddf37c7fc CAMEL-20100: camel-jsonpath - Add support for parsing
using byte[] if message body is that (#11976)
20ddf37c7fc is described below
commit 20ddf37c7fc2eb118b370115d6b9c07325330a5e
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 12 18:49:39 2023 +0100
CAMEL-20100: camel-jsonpath - Add support for parsing using byte[] if
message body is that (#11976)
---
.../src/main/java/org/apache/camel/jsonpath/JsonPathEngine.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git
a/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathEngine.java
b/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathEngine.java
index b3e4c2acc5b..b5975443e6b 100644
---
a/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathEngine.java
+++
b/components/camel-jsonpath/src/main/java/org/apache/camel/jsonpath/JsonPathEngine.java
@@ -206,6 +206,10 @@ public class JsonPathEngine {
LOG.trace("JSonPath: {} is read as String: {}", path, json);
String str = (String) json;
return JsonPath.using(configuration).parse(str).read(path);
+ } else if (json instanceof byte[]) {
+ LOG.trace("JSonPath: {} is read as byte[]: {}", path, json);
+ byte[] arr = (byte[]) json;
+ return JsonPath.using(configuration).parseUtf8(arr).read(path);
} else if (json instanceof Map) {
LOG.trace("JSonPath: {} is read as Map: {}", path, json);
Map map = (Map) json;