name, \%properties);
}
sub new_from_json {
my ($class, $json) = @_;
require JSON::MaybeXS;
return $class->new(JSON::MaybeXS::decode_json($json));
}
}
1;
### main pod documentation
ce
has foo => (...);
}
my $obj = MyModel->MooseX::DataModel::new_from_json('{"version":3,"description":"a json document"}');
# $obj is just a plain old Moose object
print $obj->version;
e key passed is different from the one declared: you
get an exception. The advantage over using a JSON validator, is that after validation you still have
your original datastructure. With MooseX::Data