JSON to Java Interfaces with Nashorn

Posted by & filed under Java, JavaScript.

Here’s a neat trick to transform JSON into Java objects that implement an interface with the same structure. Java 8 comes with Nashorn – a JavaScript runtime that has a number of extensions. One of these extensions allows you to pass a JavaScript object to a constructor of an interface to anonymously implement that interface…. Read more »