13 Mar
2011
13 Mar
'11
1:19 p.m.
On 13 March 2011 09:29, Alastair Sherringham <sherringham@gmail.com> wrote:
set serializer => 'JSON'; get '/products' => sub { return db_products(); };
If I replace the above with : get '/products' => sub { my $product_list = db_products(); content_type 'application/json'; return to_json($product_list,{ pretty => 0}); }; It works - non-pretty-printed JSON. This is actually documented in Dancer.pm (to_json section) : http://search.cpan.org/dist/Dancer/lib/Dancer.pm#to_json_%28$structure,_%opt... So, my error on missing that. Cheers, -- Alastair Sherringham http://www.sherringham.net