NAME
HTTP::Response::JSON - a subclass of HTTP::Response that understands JSON
SYNOPSIS
if ($response->isa('HTTP::Response::JSON')) {
Your::Own::Code::do_something($response->json_content);
}
DESCRIPTION
This is a simple subclass of HTTP::Response that implements a method "json_content" which returns the JSON-decoded contents of the response.
json_content
Out: $perl_data
Returns the Perl data structure corresponding to the contents of this response.
Will throw an exception if the contents look like JSON but cannot be converted to JSON. Will return undef if the contents don't look like JSON.
content_is_text
Always returns true if this is application/json, contrary to what HTTP::Message says by default, to make sure that decoded_content is properly decoded as a Unicode string.
AUTHOR
Sam Kington <skington@cpan.org>
The source code for this module is hosted on GitHub https://github.com/skington/lwp-json-tiny - this is probably the best place to look for suggestions and feedback.
COPYRIGHT
Copyright (c) 2015 Sam Kington.
LICENSE
This library is free software and may be distributed under the same terms as perl itself.