Enable json output

Requested by Gérard de Vos to enable the json output option. So added this into the code because it's very handy :)