The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test2::Tools::JSON - Compare JSON string as data structure with Test2

SYNOPSIS

    use Test2::V0;
    use Test2::Tools::JSON;
    
    is {
        foo     => 'bar',
        payload => '{"a":1}',
    }, {
        foo     => 'bar',
        payload => json({a => E}),
    };

DESCRIPTION

Test2::Tools::JSON provides comparison tools for JSON string. This module was inspired by Test::Deep::JSON.

FUNCTIONS

$check = json($expected)

Verify the value in the $got JSON string has the same data structure as $expected.

    is '{"a":1}', json({a => 1});
$check = relaxed_json($expected)

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]);

SEE ALSO

Test::Deep::JSON

Test2::Suite, Test2::Tools::Compare

LICENSE

Copyright (C) Takumi Akiyama.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Takumi Akiyama <t.akiym@gmail.com>