package io.burt.jmespath.jp;

import io.burt.jmespath.Query;
import io.burt.jmespath.JmesPathException;

public class Main {
  public static void main(String[] args) {
    if (args.length == 0 || args[0].length() == 0) {
      System.exit(1);
    }
    try {
      Query query = Query.fromString(args[0]);
      System.err.println(query);
    } catch (JmesPathException jpe) {
      System.err.println(jpe.getMessage());
      System.exit(1);
    }
  }
}

@@ -34,73 +34,338 @@
 ort 
-io.burt.jmespath.Query;%0Aimport io.burt.jmespath.JmesPathException
+java.io.IOException;%0A%0Aimport com.fasterxml.jackson.databind.ObjectMapper;%0Aimport com.fasterxml.jackson.databind.JsonNode;%0Aimport com.fasterxml.jackson.core.JsonParseException;%0A%0Aimport io.burt.jmespath.Query;%0Aimport io.burt.jmespath.Adapter;%0Aimport io.burt.jmespath.JmesPathException;%0Aimport io.burt.jmespath.jackson.JacksonAdapter
 ;%0A%0Ap
@@ -423,16 +423,35 @@
 %5B%5D args)
+ throws IOException
  %7B%0A    i
@@ -546,79 +546,387 @@
     
-Query query = Query.fromString(args%5B0%5D);%0A      System.err.println(query
+JsonNode input = new ObjectMapper().readTree(System.in);%0A      Adapter%3CJsonNode%3E adapter = new JacksonAdapter();%0A      Query query = Query.fromString(args%5B0%5D);%0A      JsonNode result = query.evaluate(adapter, input);%0A      System.out.println(result.toString());%0A    %7D catch (JsonParseException jpe) %7B%0A      System.err.println(%22Bad input: %22 + jpe.getMessage());%0A      System.exit(1
 );%0A 
@@ -987,16 +987,32 @@
 println(
+%22Bad query: %22 + 
 jpe.getM

Make the jp tool process the input too