jacksonjq:从java运行JQ命令

jacksonjq:从java运行JQ命令,java,jackson,jq,Java,Jackson,Jq,我试图使用jackson jq删除目录中所有JSON文件上的一些节点,然后将它们合并到一个JSON文件中 我已经能够让这个工作在JQ如下 //Cleanup FILES=*.json for f in $FILES; do echo "Processing $f file..." cat $f | jq 'del(.precondition, .testFailureClassname, .testFailureMessage) >tempfile &&

我试图使用jackson jq删除目录中所有JSON文件上的一些节点,然后将它们合并到一个JSON文件中

我已经能够让这个工作在JQ如下

//Cleanup
FILES=*.json
  for f in $FILES; do
    echo "Processing $f file..."
    cat $f | jq 'del(.precondition, .testFailureClassname, .testFailureMessage) >tempfile && mv tempfile $f
  done

//Merge
jq -s '.' *.json >"$basedir"/target/results.json
但我不知道如何使用jackson jq实现这一点。有什么建议吗??提前感谢。

查看自述文件,您可能下载了jar

$ curl -LO https://repo1.maven.org/maven2/net/thisptr/jackson-jq-cli/1.0.0-preview.20191208/jackson-jq-cli-1.0.0-preview.20191208.jar
验证它是否有效

$ java -jar jackson-jq-cli-1.0.0-preview.20191208.jar --help
usage: jackson-jq [OPTIONS...] QUERY
 -c,--compact      compact instead of pretty-printed output
 -h,--help         print this message
    --jq <arg>     specify jq version
 -n,--null-input   use `null` as the single input value
 -r,--raw          output raw strings, not JSON texts
看看自述文件,你大概下载了jar

$ curl -LO https://repo1.maven.org/maven2/net/thisptr/jackson-jq-cli/1.0.0-preview.20191208/jackson-jq-cli-1.0.0-preview.20191208.jar
验证它是否有效

$ java -jar jackson-jq-cli-1.0.0-preview.20191208.jar --help
usage: jackson-jq [OPTIONS...] QUERY
 -c,--compact      compact instead of pretty-printed output
 -h,--help         print this message
    --jq <arg>     specify jq version
 -n,--null-input   use `null` as the single input value
 -r,--raw          output raw strings, not JSON texts