);
# call ->to_json on the results object to get a data structure of errors
use Data::Dumper;
print Data::Dumper->Dump([$results->to_json], ['results_as_json']);
=head1 DESCRIPTION
ss()> will return false if a
single bit of data in the data structure is invalid. From there C<to_json()> can
be called on the C<$result> to get a data structure that has invalid fields as
keys and th
use Data::Dumper;
print Data::Dumper->Dump([$results->to_json], ['results_as_json']);
outputs:
$results_as_json = {
'meta' => {
lts = $dfv->check( $data );
if ( ! $results->success ) {
$c->stash->{json}{errors} = $results->to_json;
return;
}
# handle valid data
=head1 DESCRIPTION
Results of the
eturn $self->has_objects ? undef : $self->SUPER::success;
}
}
=head2 to_json
If this is an array of results, call to_json on each element and return an array
of the results. Otherwise, return a da
t
sub to_json {
my $self = shift;
my $json = [];
if ( $self->isa('ARRAY') ) {
foreach my $results ( @$self ) {
push @$json => $results->to_json;
}
} else {
$json = $self->