您的位置:首页 > 移动开发 > Objective-C

perl malformed JSON string, neither tag, array, object, number, string or atom, at character offset

2016-07-11 07:51 453 查看
[root@wx03 ~]# cat a17.pl
use JSON qw/encode_json decode_json/ ;
use Encode;
my $data = [
{
'name' => 'Ken' ,
'age' => 19
},
{
'name' => '测试' ,
'age' => 25
}
];
##解json格式

my $array = decode_json ( $data );
print "1111111111\n";

print $array->[0]->{name};;
print "\n";
print $array->[1]->{name};;
print "\n";
[root@wx03 ~]# perl a17.pl
malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "(end of string)") at a17.pl line 15.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: