On 08/25/2014 02:36 PM, David E. Wheeler wrote:
On Aug 25, 2014, at 11:32 AM, Andrew Dunstan <[email protected]> wrote:
Well, of course, json and jsonb are already serializations. Even jsonb in
binary mode is sent to the client as a json string (with a version number in
case we ever decide to send/receive a different binary format).
And turning a composite into json is pretty simple - in 9.4 it's just
to_json(recordval). populate_json(null::recordtype, jsonval) pretty much does
the reverse. On the perl side there are well known modules for moving between
hashes and json objects. Maybe with some sort of Tie mechanism you could make
that almost transparent?
No, I meant convert /JSONB?/ values to and from hashes or arrays.
I'm not following.
In the hands of a client jsonb is still just a string, more or less. And
of course json is just a string anyway. We never send the jsonb on-disk
format to a client, even in binary mode.
cheers
andrew