A colleague recently asked me to extract some information/text from a json file in a Docker container. This Docker container has no things like Python or Perl included, and it’s dedicated to Java application only. Parsing json with grep/awk seems a bit intimidating. At last, I recalled that Java is shipped with a Javascript engine and after simply googling found the jjs. We used Javascript as the script language and jjs as the script interpreter to solve the problem.

Java SE 8 will instead ship with a new engine called Oracle Nashorn, which is based on JSR 292 and invokedynamic. It provides better compliance with the ECMA normalized JavaScript specification …

To do so, builds of Oracle’s JDK or OpenJDK include a command-line tool called jjs. It can be found in the bin/ folder of a JDK installation along with the well-known java, javac, or jar tools.

More details in this doc