Add support for json output, improve EXAMPLE.lua.

Signed-off-by: Ross Allan <rallanpcl@gmail.com>