use JSON; use utf8; my $r = {foo => "Fünf € Lösung"}; binmode STDOUT,':bytes'; print JSON->new->utf8(1)->encode($r),"\n";