Re: [Catalyst] Catalyst::View::JSON sends a file
2010/1/12 Tomas Doran : > Your browser will do whatever it normally does with the mime type you're > sending. > > By changing settings or mime types you'll probably be able to convince it to > display the JSON. Or just install the FireFox addon 'JSONView' which will show you the JSON in the browser window in the same way that you see XML (with pretty colours and stuff). This is best as it puts the smarts where you want them (in your browser) rather than in the app where the unintended consequences kick in. Cheers, Edmund. PS: as a side note you're being asked to download a file because the mime-type for JSON is 'application/json' so the browser assumes that it is not human readable. There is a chirpy little holy war about all the mime-types that are 'text/*' that should actually be 'application/*' - like 'text/xml' for example. But I digress... ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::View::JSON sends a file
2010/1/12 Alan Humphrey : >> From: Christoph Friedrich [mailto:christ...@christophfriedrich.de] >> just worked a little with Catalyst::View::JSON. But when I call some >> action via Firefox that uses this View Firefox gives me a file to >> download and don't show the json directly. >> Is there a way to change this behavior? I want to see what I would get >> as JSON and not download it ^^ > > Use firebug. The Console tab will show you the GET as well as the response. ITYM the Net tab. Phil ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::View::JSON sends a file
Tomas Doran wrote: On 11 Jan 2010, at 23:29, Christoph Friedrich wrote: just worked a little with Catalyst::View::JSON. But when I call some action via Firefox that uses this View Firefox gives me a file to download and don't show the json directly. Is there a way to change this behavior? I want to see what I would get as JSON and not download it ^^ Your browser will do whatever it normally does with the mime type you're sending. By changing settings or mime types you'll probably be able to convince it to display the JSON. You could also adjust the $c->response->content_type() to be 'text/plain'. But watch out, as some javascript libraries decide what to do with the response based on it's content-type, and will not JSON-decode what it thinks is html or plain text. However, why not write a JSON debug view that pretty prints JSON responses inside an HTML page? Definitely the better option. Or learn to get into the Firefox or Chrome javascript debuggers.. well worth having that skill. Toby ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] Catalyst::View::JSON sends a file
> -Original Message- > From: Christoph Friedrich [mailto:christ...@christophfriedrich.de] > Sent: Monday, January 11, 2010 3:29 PM > To: The elegant MVC web framework > Subject: [Catalyst] Catalyst::View::JSON sends a file > > Hello there, > > just worked a little with Catalyst::View::JSON. But when I call some > action via Firefox that uses this View Firefox gives me a file to > download and don't show the json directly. > Is there a way to change this behavior? I want to see what I would get > as JSON and not download it ^^ > > Greets > Christoph > Use firebug. The Console tab will show you the GET as well as the response. - Alan ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::View::JSON sends a file
On 11 Jan 2010, at 23:29, Christoph Friedrich wrote: just worked a little with Catalyst::View::JSON. But when I call some action via Firefox that uses this View Firefox gives me a file to download and don't show the json directly. Is there a way to change this behavior? I want to see what I would get as JSON and not download it ^^ Your browser will do whatever it normally does with the mime type you're sending. By changing settings or mime types you'll probably be able to convince it to display the JSON. However, why not write a JSON debug view that pretty prints JSON responses inside an HTML page? Cheers t0m ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Catalyst::View::JSON sends a file
Hello there, just worked a little with Catalyst::View::JSON. But when I call some action via Firefox that uses this View Firefox gives me a file to download and don't show the json directly. Is there a way to change this behavior? I want to see what I would get as JSON and not download it ^^ Greets Christoph ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/