Re: Stability of JSON textual representation - Mailing list pgsql-general

From David Evans
Subject Re: Stability of JSON textual representation
Date
Msg-id CAHbVmPyxOJzJkZ1aR=qNKNfz5Y4464e--rF-1GF9=SJZxyVAmg@mail.gmail.com
Whole thread Raw
In response to Re: Stability of JSON textual representation  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
Responses Re: Stability of JSON textual representation
List pgsql-general
On 9 February 2015 at 03:57, Gavin Flower <GavinFlower@archidevsys.co.nz> wrote:
 Would using jsonb be more consistent?

Yes, casting to jsonb seems produce consistent output:

# SELECT array_to_json(array[1, 2, 3])::jsonb, json_build_array(1, 2, 3)::jsonb;
 array_to_json | json_build_array 
---------------+------------------
 [1, 2, 3]     | [1, 2, 3]

That makes sense I suppose, given that only the structure in preserved in the jsonb representation.

Thanks! I should have thought of that myself.

Dave

pgsql-general by date:

Previous
From: Oliver
Date:
Subject: Re: Change postgresql encoding
Next
From: Vladislav Tchernev
Date:
Subject: Mult-standby streaming replication master failover