Skip to content

Instantly share code, notes, and snippets.

@imyaman
Created April 4, 2018 15:44
Show Gist options
  • Save imyaman/7953bd89dd7cc16aa3925ac864aba57f to your computer and use it in GitHub Desktop.
Save imyaman/7953bd89dd7cc16aa3925ac864aba57f to your computer and use it in GitHub Desktop.
perl json decode
#!/usr/bin/perl
use strict;
use warnings;
use JSON (decode_json);
use Data::Dumper;
use utf8;
$content = qq/ {"Name":"Sangyong Gwak","성명":"곽상용"} /;
print $content;
print "\n" . " ---- ---- ---- ----" . "\n";
#my $perl_hash=decode('UTF-8', $content);
#my $perl_hash = decode_json($content);
my $perl_hash = JSON->new->utf8->decode($content);
print Dumper $perl_hash;
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment