将JSON反序列化为受祝福的对象

时间:2013-07-09 21:16:12

标签: json perl serialization

"How to convert Perl objects into JSON and vice versa"接受的答案说转换是毛茸茸的。

有没有人真正使用JSON反序列化嵌套的祝福对象?怎么样?

1 个答案:

答案 0 :(得分:0)

使用JSYNC

perl -Moose=Foo -MJSYNC -e'
    has "attr", is => "rw", isa => "HashRef[HashRef]", default => sub { { 0 => { 1 => { 3 => 4} } } };
    print JSYNC::dump(Foo->new)
'
{"!":"!perl/hash:Foo","attr":{"0":{"1":{"3":"4"}}}}