You can do that with View::JSON :) Just read the docs though, the reason
it didn't work is that you put your data in
$c->stash->{json} = [ ... ]
And View::JSON will attempt to turn your entire stash into JSON data :)
And it does that bit correctly, but the thing you end up with is
{
json: [ ... ]
}
And autocomplete doesn't like that. So, either do:
$c->stash([ ... ])
Or set the expose_stash setting. Whatever is set in there, is the only
thing that View::JSON will attempt to serialise.
Personally I prefer expose_stash => 'json', so that anything under
$c->stash->{json} is serialised, but up to you :)
Hetényi Csaba wrote:
Dear Ben van Staveren
Thank You, now it is working, but in this case, i don't know
why to use Catalyst::View::JSON, it is just a text formatting.
Later I'd like to use DBIx datasource to feed autocomplete plugin,
in this case i must manually build a special JSON formatted string.
Is there exist a better way?
Thank You!
Ben van Staveren írta:
Looks like you need to set
expose_stash => 'json'
in your config.
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive:
http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
--
Ben van Staveren
phone: +62 81 70777529
email: [email protected]
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/