
Dotiac::DTL::Addon::jsonify: Dump any data to json.

Load from a Dotiac::DTL-template:
{% load jsonify %}
Load in Perl file for all templates:
use Dotiac::DTL::Addon::jsonify;
Then it can be used:
{{ data|jsonify }}

via CPAN:
perl -MCPAN -e "install Dotiac::DTL::Addon::jsonify"
or get it from https://sourceforge.net/project/showfiles.php?group_id=249411&package_id=306751, extract it and then run in the extracted folder:
perl Makefile.PL
make test
make install

After http://www.djangosnippets.org/snippets/1250/, generates data from json objects.
Converts any value into JSON, even lists and dictionaries.
Output will be in ASCII, the returned value will always be safe.
data=>{List=>[1,2,3],Value=>"Foo\x{34fc}"};
<a onclick="return {{ data|jsonify|escape }}">
{# <a onclick="return {"List":[1,2,3],"Value":"FooÒô+"}"> #}
var Value={{ data|jsonify| }}
{# var Value={"List":[1,2,3],"Value":"FooÒô+"} #}

Please report any bugs or feature requests to https://sourceforge.net/tracker2/?group_id=249411&atid=1126445

This distribution is published under the terms of the MIT license, which basically means "Do with it whatever you want". For more information, see the LICENSE file that should be enclosed with this distribution. A copy of the license is (at the time of writing) also available at http://www.opensource.org/licenses/mit-license.php.

Dotiac::DTL, Dotiac::DTL::Addon, http://www.dotiac.com, http://www.djangoproject.com
Dotiac::DTL::Addon::json has some more options, but does mostly the same.

Marc-Sebastian Lucksch
perl@marc-s.de