Test2::Tools::JSON - Compare JSON string as data structure with Test2
use Test2::V0; use Test2::Tools::JSON; is { foo => 'bar', payload => '{"a":1}', }, { foo => 'bar', payload => json({a => E}), };
Test2::Tools::JSON provides comparison tools for JSON string. This module was inspired by Test::Deep::JSON.
Verify the value in the $got JSON string has the same data structure as $expected.
$got
$expected
is '{"a":1}', json({a => 1});
Verify the value in the $got relaxed JSON string has the same data structure as $expected.
is '[1,2,3,]', relaxed_json([1,2,3]);
Test::Deep::JSON
Test2::Suite, Test2::Tools::Compare
Copyright (C) Takumi Akiyama.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Takumi Akiyama <t.akiym@gmail.com>
To install Test2::Tools::JSON, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test2::Tools::JSON
CPAN shell
perl -MCPAN -e shell install Test2::Tools::JSON
For more information on module installation, please visit the detailed CPAN module installation guide.