Re: Proposal: Add JSON support

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Proposal: Add JSON support
Date: 2010-03-28 21:42:32
Message-ID: 4BAFCD48.3070903@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas wrote:
> On Sun, Mar 28, 2010 at 4:48 PM, Joseph Adams
> <joeyadams3(dot)14159(at)gmail(dot)com> wrote:
>
>> I'm wondering whether the internal representation of JSON should be
>> plain JSON text, or some binary code that's easier to traverse and
>> whatnot. For the sake of code size, just keeping it in text is
>> probably best.
>>
>
> +1 for text.
>

Agreed.
>
>> Now my thoughts and opinions on the JSON parsing/unparsing itself:
>>
>> It should be built-in, rather than relying on an external library
>> (like XML does).
>>
>
> Why? I'm not saying you aren't right, but you need to make an
> argument rather than an assertion. This is a community, so no one is
> entitled to decide anything unilaterally, and people want to be
> convinced - including me.
>

Yeah, why? We should not be in the business of reinventing the wheel
(and then maintaining the reinvented wheel), unless the code in question
is *really* small.

>
>> As far as character encodings, I'd rather keep that out of the JSON
>> parsing/serializing code itself and assume UTF-8. Wherever I'm wrong,
>> I'll just throw encode/decode/validate operations at it.
>>
>
> I think you need to assume that the encoding will be the server
> encoding, not UTF-8. Although others on this list are better
> qualified to speak to that than I am.
>
>
>

The trouble is that JSON is defined to be specifically Unicode, and in
practice for us that means UTF8 on the server side. It could get a bit
hairy, and it's definitely not something I think you can wave away with
a simple "I'll just throw some encoding/decoding function calls at it."

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-03-28 22:32:36 five-key syscaches
Previous Message Robert Haas 2010-03-28 21:19:37 Re: Proposal: Add JSON support