Looks like you need to set

expose_stash => 'json'

in your config.

Hetényi Csaba wrote:
Dear Rodrigo

I tired your tip, but my response is:

{"json":[{"value":"Paddyfield Warbler","label":"Paddyfield Warbler","id":"Acrocephalus agricola"}]}

and -of course- there is no any suggest. :(

I thought that Catalyst::View::JSON translate perl datastructures to
corresponding JSON data structure ( hash > object ... as i see on http://www.json.org) automatically. ( if not, i could use manually
created JSON formatted string without any JSON module)

Thank You!




Have you tried this?

sub request : Local {
    my ($self,$c) = @_;
$c->stash->{json} = [ { id=>"Acrocephalus agricola", label=> "Paddyfield Warbler", value=> "Paddyfield Warbler" } ];
    $c->forward('View::JSON');
}

It gives me back the following response:

$ curl http://localhost:3000/request <http://localhost:3000/test>
[{"value":"Paddyfield Warbler","id":"Acrocephalus agricola","label":"Paddyfield Warbler"}]

Which works with JQuery's autocomplete example just fine

-rodrigo


------------------------------------------------------------------------

_______________________________________________
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/


_______________________________________________
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/

Reply via email to