Test::Deep::JSON - Compare JSON with Test::Deep
use Test::Deep; use Test::Deep::JSON; cmp_deeply { foo => 'bar', payload => '{"a":1}', }, { foo => 'bar', payload => json({ a => ignore() }), };
Test::Deep::JSON provides the json($expected) function to expect that target can be parsed as a JSON string and matches (by cmp_deeply) with $expected.
json($expected)
cmp_deeply
Exported by default.
$expected can be anything that Test::Deep recognizes.
Test::Deep
This parses the data as a JSON string, and compares the parsed object and $expected by Test::Deep functionality.
Fails if the data cannot be parsed as a JSON string.
motemen <motemen@gmail.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Test::Deep::JSON, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Deep::JSON
CPAN shell
perl -MCPAN -e shell install Test::Deep::JSON
For more information on module installation, please visit the detailed CPAN module installation guide.