The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

SYNOPSIS

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 }}

INSTALLATION

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

DESCRIPTION

After http://www.djangosnippets.org/snippets/1250/, generates data from json objects.

Filters

json

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 {&quot;List&quot;:[1,2,3],&quot;Value&quot;:&quot;FooÒô+&quot;}"> #}
        
        var Value={{ data|jsonify| }} 
        {# var Value={"List":[1,2,3],"Value":"FooÒô+"} #}

BUGS

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

LICENSE

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.

SEE ALSO

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.

AUTHOR

Marc-Sebastian Lucksch

perl@marc-s.de

1 POD Error

The following errors were encountered while parsing the POD:

Around line 109:

Non-ASCII character seen before =encoding in '{&quot;List&quot;:[1,2,3],&quot;Value&quot;:&quot;FooÒô+&quot;}">'. Assuming CP1252