Add option to pretty-print json encoding

@dlondero please review