use JSON; my %stuff = ( ro => "...", sham => "...", bo => "...anything here" ); my $json = JSON->new->utf8(1)->pretty(1)->encode( \%stuff ); print $json; __END__ { "ro" : "...", "bo" : "...anything here", "sham" : "..." }