ckage JSON::Typist 0.008;
# ABSTRACT: replace mushy strings and numbers with rigidly typed replacements
#pod =head1 OVERVIEW
#pod
#pod JSON is super useful and everybody loves it. Woo! Go JSON! Go
need to know. You might using JSON for interchange with a
#pod system that needs its types in its values. JSON::Typist is meant for this
#pod problem.
#pod
#pod L<JSON> (in its many variant forms) a
t as the variables are
#pod used. (That's just a weird-o Perl problem.) JSON::Typist is meant to take the
#pod result of JSON-decoding I<immediately> before you use it for anything else. It
#pod re
use strict;
use warnings;
package JSON::Typist::DataPrinter 0.008;
# ABSTRACT: a helper for Data::Printer-ing JSON::Typist data
use Data::Printer use_prototypes => 0;
use Term::ANSIColor qw(colored)
= 'ansi214';
use Sub::Exporter -setup => [ qw( jdump ) ];
#pod =head1 SYNOPSIS
#pod
#pod use JSON::Typist::DataPrinter qw( jdump );
#pod
#pod my $data = get_typed_data_from_your_code();
#pod
#p
},
'JSON::PP::Boolean' => sub { colored([$BOOL_COLOR], $_[0] ? 'true' : 'false') },
}
],
)
);
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::Typist::Data
warnings;
package Test::Deep::JType 0.008;
# ABSTRACT: Test::Deep helpers for JSON::Typist data
use JSON::PP ();
use JSON::Typist ();
use Test::Deep 1.126 (); # LeafWrapper, as_test_deep_cmp
use Exp
y for testing data structures.
#pod Test::Deep::JType extends it with routines for testing
#pod L<JSON::Typist>-annotated data.
#pod
#pod By default, Test::Deep's C<cmp_deeply> will interpret plain nu
eans that this test
#pod won't work:
#pod
#pod my $json = q[ { "key": "value" } ];
#pod my $data = decode_json($json);
#pod my $typed = JSON::Typist->new->apply_types( $data );
#pod
#pod cmp