package Plack::Middleware::Signposting::JSON;
our $VERSION = '0.06';
use Catmandu::Sane;
use Catmandu;
use Catmandu::Fix;
use JSON qw(decode_json);
use Plack::Request;
use Plack::Util::Accessor qw(f
($res->[1], 'Content-Type') || '';
# only json responses
return unless $content_type =~ m{^application/json|application\/vnd\.api\+json}i;
# ignore streaming response for now
s ref $res->[2] eq 'ARRAY';
my $body = join('', @{$res->[2]});
my $data = decode_json($body);
if (ref $data && ref $data eq 'ARRAY') {
$data = $data->[0];