我尝试了很多时间将perl对象转换为JSON字符串。但我仍然无法找到。我使用JSYNC。但我看到它有一些问题。然后我在perl中使用JSON模块。 这是我的代码。
如何将perl对象转换为json字符串
my $accountData = AccountsData ->new();
$accountData->userAccountsDetail(@userAccData);
$accountData->creditCardDetail(@userCrData);
my $json = to_json($accountData,{allow_blessed=>1,convert_blessed=>1});
print $json."\n";
当我运行代码,它打印null
。就是有没有搞错我都做了些什么?
请在www.cpan.org检查模块JSON :: XS或JSON – 2012-07-31 12:13:34