<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta content="text/html; charset=utf-8">
</head>
<body>
<div style="font-family:'Calibri','sans-serif'">
<div>Yes will do.</div>
<div><br>
</div>
<div>z</div>
<div><br>
</div>
<div>Sent from my HTC</div>
<br>
<div id="htc_header">----- Reply message -----<br>
From: "Sawyer X" <xsawyerx@gmail.com><br>
To: "Perl Dancer users mailing list" <dancer-users@dancer.pm><br>
Subject: [dancer-users] JSON Serialiser<br>
Date: Thu, Jul 23, 2015 22:34</div>
</div>
<br>
<div>
<div dir="ltr">Hmm... I'm not sure why you're getting this problem.
<div><br>
</div>
<div>Usually the problem people have is confusing routes that return HTML to ones that return JSON and then expecting it to handle both in the same App (which we removed for several reasons - as explained in blog posts, the advent calendar, the mailing list,
 Github, and the changelog).</div>
<div><br>
</div>
<div>However, I'm not sure why *this* wouldn't work.</div>
<div><br>
</div>
<div>Can you reduce this to a test case? I would be happy to understand this better.</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Sun, Jul 19, 2015 at 11:32 AM, Zahir Lalani <span dir="ltr">
<<a href="mailto:ZahirLalani@oliver.agency" target="_blank">ZahirLalani@oliver.agency</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
--From: dancer-users [mailto:<a href="mailto:dancer-users-bounces@dancer.pm">dancer-users-bounces@dancer.pm</a>] On Behalf Of Sawyer X<br>
--Sent: 19 July 2015 00:31<br>
--To: Perl Dancer users mailing list<br>
--Subject: Re: [dancer-users] JSON Serialiser<br>
<br>
--I don't understand this email. T abundance of HTML in your message is quite disruptive.<br>
------<br>
<br>
My apologies for the confusion. Let me try again…..<br>
<br>
I had code which was working just fine two months ago. It relied on the automatic JSON deserialise + blessed objects. I was able to "return" a Moo object as a response to a REST request and the output would correctly show the json. So the basic format for this
 is:<br>
<br>
get '/xxxx' => sub {<br>
     return AnObject->new;<br>
};<br>
<br>
AnObject has TO_JSON implemented.<br>
<br>
I came back to this project after 2 months and found that it no longer worked - I would get an error of the form " Unrecognized response type from route". I found  a thread from April 15th which showed the same issue and a solution. (this is what I tried to
 include!). The solution was to wrap the response object in a hash as below:<br>
<br>
get '/xxxx' => sub {<br>
    return { result => AnObject->new };<br>
};<br>
<br>
My question is: which should be the correct way. My previous way worked and then something must have changed. Was the change deliberate? I have no issue with the solution above, I just want to understand whether this is the expected behaviour now.<br>
<br>
Z<br>
<br>
_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</body>
</html>