Check for value of a JSON key

Disclaimer: I do not know Perl, so it's worth reviewing carefully!