[dancer-users] Returning JSON Data

Russell Jenkins russell.jenkins at strategicdata.com.au
Tue Sep 29 08:31:15 BST 2015


Hi Robert.

Sorry for this terse reply, I've gotta run.

On 29/09/2015 1:54 am, Robert Smith wrote:
> It doesn’t "just work” however it seems.

Cut it down to a basic test case. eg:

===
use Dancer2;
set serializer => 'JSON';
get '/' => sub {
   return +{
     1 => {
       address=> '東京都渋谷区上原2−48',
       client_id => '1123',
       id => '1',
       name => 'WANSecurity, K.K.',
     },
   };
};
dance;
===

Save to a file, and run with plackup.


Again, you need to ensure you get *characters* back from the database.
Please read the DBD::Pg docs on the pg_enable_utf8 connection attribute..

Cheers,
   Russell.









More information about the dancer-users mailing list