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-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to