You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/05/06 04:25:05 UTC
[GitHub] [camel-karavan] davsclaus opened a new issue, #335: JSonPath Evaluator
davsclaus opened a new issue, #335:
URL: https://github.com/apache/camel-karavan/issues/335
When working with json data, then the camel-jsonpath language is useful to grab specific data or define how a json payload should be splitted with Split EIP etc.
I wonder if we can have a page in karavan where users can enter a json payload example, and then a text field to type in json path and then we have an online evaluation showing the result.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] JSonPath Evaluator [camel-karavan]
Posted by "mgubaidullin (via GitHub)" <gi...@apache.org>.
mgubaidullin closed issue #335: JSonPath Evaluator
URL: https://github.com/apache/camel-karavan/issues/335
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-karavan] mgubaidullin commented on issue #335: JSonPath Evaluator
Posted by GitBox <gi...@apache.org>.
mgubaidullin commented on issue #335:
URL: https://github.com/apache/camel-karavan/issues/335#issuecomment-1124213374
we can add a button "Evaluate" that opens a modal window to evaluate
<img width="436" alt="Screen Shot 2022-05-11 at 3 30 29 PM" src="https://user-images.githubusercontent.com/1379213/167930630-a799570c-4d67-44a9-8fdd-7a0c5cf40029.png">
then how to actually evaluate?
1. For web app version we could create a rest endpoint for evaluation
2. For VS Code extension? There is no backend...
We can make a script jsonpath.java
```
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS com.jayway.jsonpath:json-path:2.7.0
//DEPS org.slf4j:slf4j-nop:1.7.30
class jsonpath {
public static void main(String[] args) {
String json = args[0];
Object document = com.jayway.jsonpath.Configuration.defaultConfiguration().jsonProvider().parse(json);
String result = com.jayway.jsonpath.JsonPath.read(document, args[1]);
System.out.println(result);
}
}
```
and call it command line using jbang
`jbang jsonpath.java '{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95}},"expensive":10}' '$.store.book[0].author' --quiet`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [camel-karavan] davsclaus commented on issue #335: JSonPath Evaluator
Posted by GitBox <gi...@apache.org>.
davsclaus commented on issue #335:
URL: https://github.com/apache/camel-karavan/issues/335#issuecomment-1125173417
Yeah we can run java quickly now with jbang scripts.
Though for the existing tooling such as the Camel IDEA plugin there is API on CamelCatalog that can validate languages
https://github.com/apache/camel/blob/main/catalog/camel-catalog/src/main/java/org/apache/camel/catalog/CamelCatalog.java#L433
https://github.com/apache/camel/blob/main/catalog/camel-catalog/src/main/java/org/apache/camel/catalog/CamelCatalog.java#L420
There are 2 one for predicate vs expression. Frankly its mostly for simple language that behaves differently in these modes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org