summaryrefslogtreecommitdiff
path: root/lib/TUWF/Response.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/TUWF/Response.pm')
-rw-r--r--lib/TUWF/Response.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/TUWF/Response.pm b/lib/TUWF/Response.pm
index 9918879..21e6fce 100644
--- a/lib/TUWF/Response.pm
+++ b/lib/TUWF/Response.pm
@@ -185,14 +185,14 @@ sub resNotFound {
}
+my $_json_codec;
sub resJSON {
my($self, $obj) = @_;
- croak "Unable to load JSON::XS, is it installed?\n"
- unless eval { require JSON::XS; 1 };
+ $_json_codec ||= TUWF::Misc::_JSON()->new->utf8;
$self->resHeader('Content-Type' => 'application/json; charset=UTF-8');
$self->resBuffer('clear');
- $self->resBinary(JSON::XS::encode_json($obj));
+ $self->resBinary($_json_codec->encode($obj));
}