Template::Plugin::JSON - Adds a .json vmethod for all TT values.
version 0.08
[% USE JSON ( pretty => 1 ) %]; <script type="text/javascript"> var foo = [% foo.json %]; </script> or read in JSON [% USE JSON %] [% data = JSON.json_decode(json) %] [% data.thing %]
This plugin provides a .json vmethod to all value types when loaded. You can also decode a json string back to a data structure.
.json
It will load the JSON::MaybeXS module, which will use Cpanel::JSON::XS when possible and fall back to JSON::PP otherwise.
Any options on the USE line are passed through to the JSON object, much like "to_json" in Cpanel::JSON::XS.
JSON::MaybeXS, Template::Plugin
Bugs may be submitted through the RT bug tracker (or bug-Template-Plugin-JSON@rt.cpan.org).
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
Neil Bowers <neil@bowers.com>
Karen Etheridge <ether@cpan.org>
Graham Barr <gbarr@pobox.com>
Leo Lapworth <leo@cuckoo.org>
perigrin <perigrin@cpan.org>
This software is Copyright (c) 2006 by Yuval Kogman.
This is free software, licensed under:
The MIT (X11) License
To install Template::Plugin::JSON, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Plugin::JSON
CPAN shell
perl -MCPAN -e shell install Template::Plugin::JSON
For more information on module installation, please visit the detailed CPAN module installation guide.