Add an option to format the output

Add an option to format the output using go template package.
If not specified it, the output is JSON-formatted just like current behavior.