7 my $data = JSON::MaybeXS->new->decode('{"foo": true, "bar": false, "baz": 1}');
8 diag 'true is: ', explain $data->{foo};
9 diag 'false is: ', explain $data->{bar};
12 JSON::MaybeXS::is_bool($data->{foo}),
13 JSON() . ': true decodes to a bool',
16 JSON::MaybeXS::is_bool($data->{bar}),
17 JSON() . ': false decodes to a bool',
20 !JSON::MaybeXS::is_bool($data->{baz}),
21 JSON() . ': int does not decode to a bool',
25 JSON::MaybeXS::encode_json([JSON::MaybeXS::true]),
27 JSON() . ': true sub encodes as correct boolean',
31 JSON::MaybeXS::encode_json([JSON::MaybeXS->true]),
33 JSON() . ': true method encodes as correct boolean',
37 JSON::MaybeXS::encode_json([JSON::MaybeXS::false]),
39 JSON() . ': false sub encodes as correct boolean',
43 JSON::MaybeXS::encode_json([JSON::MaybeXS->false]),
45 JSON() . ': false method encodes as correct boolean',