From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

my $json = '{
"for": {
"key": "testing",
"each": "testing",
"abc": 123
}
}';
my $compiled = JSON::Conditional->new->compile($json, {
testing => [
{ test => "other" },
{ test => "test" },
{ test => "other" },
{ test => "thing" },
]
}, 1);
my $expected = {
testing => [
{ abc => 123 },
{ abc => 123 },
{ abc => 123 },
{ abc => 123 },
]
};
is_deeply($compiled, $expected);
done_testing;