NAME
Mojolicious::Plugin::InlineJSON - Bootstrap your app with inline JSON
SYNOPSIS
# Mojolicious
use Mojolicious;
$app->plugin('InlineJSON');
# Mojolicious::Lite
plugin 'InlineJSON';
# in your controller
$c->stash(important_stuff => { data => [ ... ] });
# then, in a template
DESCRIPTION
Mojolicious::Plugin::InlineJSON is a Mojolicious plugin for rendering
data to json in a template. This is useful for when you want to serve
content managed dynamically by javascript without needing any extra AJAX
calls after the page loads.
This plugin provides 3 different helpers for rendering JSON in a variety
of different ways.
HELPERS
js_data
"js_data" will render the perl data structure passed to it into a
literal javascript structure, capable of being directly consumed by
javascript.
In essence, it turns this
{ key => 'value' }
into
{ key: 'value' }
while making sure to avoid any attribute escaping or accidental tag
closure.
js_json_string