in reply to Re^2: customized JSON pretty print
in thread customized JSON pretty print

A quick look into JSON::PP reveals that there is a function array_to_json and in there a line

my ($pre, $post) = $indent ? $self->_up_indent() : ('', '');

If you change that to

my ($pre, $post) = ('', '');

pretty stops prettifying arrays.

use JSON::PP; my %HoA = ('foo' => [1,2,3], 'bar' => ['a','b','c']); print "plain:\n".JSON::PP->new->encode(\%HoA)."\n"; print "pretty:\n".JSON::PP->new->pretty->encode(\%HoA);