JSON support in PostgreSQL 9.4 is pretty awesome, and i'd love to make it 
easier to use with Mojo::Pg.

    https://gist.github.com/anonymous/7409f3d24ae26208d533

But i'm not sure yet what that should look like, this partial patch is just 
one possibility.

    # JSON roundtrip
    $db = $pg->db;
    is_deeply $db->json({bar => 'baz'})->query('select ?::json as 
foo')->hash,
      {foo => {bar => 'baz'}}, 'right structure';

Decoding JSON automatically in Mojo::Pg::Results is mostly a no-brainer, 
but where it gets complicated is encoding. DBD::Pg already serializes array 
references to native PostgreSQL arrays and simple strings/numbers are also 
valid JSON documents. Maybe someone here has an idea for a sleek JSON API?

--
sebastian

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to