<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">That said, your error implies that you are not returning a hash or array reference from your route? Have you tried dumping your return value to check?</span><br style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"></blockquote></div><br><div>I think the thing that confuses me the most is that this is happening out of the box with the generated app, does this happen for anyone else? If it’s unique to me, then there must be something funny about my environment. Can someone else test this on latest Dancer2:</div><div><br></div><div> dancer2 -a MyApp && cd MyApp</div><div> add the line serializer: "JSON" to config.yml<br> plackup ./bin/app.pl -p 5000 -I lib<br></div><div> load page in browser or cURL:</div><div><br></div><div><div>curl -v <a href="http://localhost:5000/">http://localhost:5000/</a></div><div>* About to connect() to localhost port 5000 (#0)</div><div>* Trying ::1... Connection refused</div><div>* Trying 127.0.0.1... connected</div><div>* Connected to localhost (127.0.0.1) port 5000 (#0)</div><div>> GET / HTTP/1.1</div><div>> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2</div><div>> Host: localhost:5000</div><div>> Accept: */*</div><div>></div><div>* HTTP 1.0, assume close after body</div><div>< HTTP/1.0 200 OK</div><div>< Date: Sat, 20 Dec 2014 20:30:43 GMT</div><div>< Server: HTTP::Server::PSGI</div><div>< Server: Perl Dancer2 0.157000</div><div>< Content-Type: text/html</div><div>< Content-Length: 0</div><div><</div><div>* Closing connection #0</div></div><div><br></div><div>(log from placket console)</div><div><div><br></div><div>HTTP::Server::PSGI: Accepting connections at <a href="http://0:5000/">http://0:5000/</a></div><div>[MyApp:106928] core @2014-12-21 07:21:40> looking for get / in /perf/perl/lib/perl5/Plack/Middleware/RemoveRedundantBody.pm l. 14</div><div>[MyApp:106928] core @2014-12-21 07:21:40> Entering hook core.app.before_request in /perf/perl/lib/perl5/Dancer2/Core/App.pm l. 1232</div><div>[MyApp:106928] core @2014-12-21 07:21:40> Failed to serialize the request: hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at /perf/perl/lib/perl5/JSON.pm line 154. in (eval 219) l. 2</div><div>[MyApp:106928] core @2014-12-21 07:21:40> Entering hook core.app.after_request in /perf/perl/lib/perl5/Dancer2/Core/App.pm l. 1189</div><div>192.168.128.1 - - [21/Dec/2014:07:21:40 +1100] "GET / HTTP/1.1" 200 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:34.0) Gecko/20100101 Firefox/34.0”</div><div>[MyApp:106928] core @2014-12-21 07:30:43> looking for get / in /perf/perl/lib/perl5/Plack/Middleware/RemoveRedundantBody.pm l. 14</div><div>[MyApp:106928] core @2014-12-21 07:30:43> Entering hook core.app.before_request in /perf/perl/lib/perl5/Dancer2/Core/App.pm l. 1232</div><div>[MyApp:106928] core @2014-12-21 07:30:43> Failed to serialize the request: hash- or arrayref expected (not a simple scalar, use allow_nonref to allow this) at /perf/perl/lib/perl5/JSON.pm line 154. in (eval 219) l. 2</div><div>[MyApp:106928] core @2014-12-21 07:30:43> Entering hook core.app.after_request in /perf/perl/lib/perl5/Dancer2/Core/App.pm l. 1189</div><div>127.0.0.1 - - [21/Dec/2014:07:30:43 +1100] "GET / HTTP/1.1" 200 0 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2”</div></div><div><br></div><div>Matt</div><div><br></div></body></html>