package Test2::Compare::JSON::Pointer;
use strict;
use warnings;
use Test2::Util::HashBase qw( pointer input json );
use JSON::Pointer;
use Encode ();
use parent 'Test2::Compare::Base';
# ABSTRACT:
entation of a hash or array reference pointed to by a JSON pointer during deep comparison.
our $VERSION = '0.02'; # VERSION
sub operator { 'JSON PTR' }
sub name
{
my($self) = @_;
my($input, $po
t_root_ref = eval {
$self->{+JSON}->decode($self->_convert_got($got));
};
my $pointer = $self->{+POINTER};
my $id = [ META => $pointer eq '' ? 'JSON' : "JSON $pointer" ];
if(my $error =
st2::Tools::JSON::Pointer;
use strict;
use warnings;
use utf8;
use 5.008001;
use JSON::MaybeXS qw( JSON );
use Test2::Compare::JSON::Pointer;
use parent 'Exporter';
our @EXPORT = qw( json );
# ABST
RACT: Compare parts of JSON string to data structure using JSON pointers VERSION
our $VERSION = '0.02'; # VERSION
sub json ($;$)
{
my($pointer, $json) = @_ == 1 ? ('', $_[0]) : (@_);
my @caller
= caller;
Test2::Compare::JSON::Pointer->new(
file => $caller[1],
lines => [$caller[2]],
input => $json,
pointer => $pointer,
json => JSON->new->utf8(1),
);
}
my $co