Stefan Hornburg (Racke) > Template-Flute-0.0061 > Template::Flute::Filters::JsonVar

Download:
Template-Flute-0.0061.tar.gz

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source   Latest Release: Template-Flute-0.0140

NAME ^

Template::Flute::Filters::JsonVar - JSON to Javascript variable filter

DESCRIPTION ^

Takes a Perl structure or a JSON string and returns Javascript which parses the JSON string with Jquery and assigns it to the variable json.

Example:

    {username => 'shopper@nitesi.biz', city => 'Vienna'};

results in the following JavaScript:

    var json = $.parseJSON('{"post":"Vienna","username":"shopper@nitesi.biz"}');

PREREQUISITES ^

JSON module.

METHODS ^

init

The init method allows you to set the following options:

engine

Value is either jquery or eval.

filter

Filters the given Perl structure to a JSON string.

syntax highlighting: