Re: Stability of JSON textual representation

From: David Evans <david(dot)evans(at)cantab(dot)net>
To: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Stability of JSON textual representation
Date: 2015-02-09 09:07:48
Message-ID: CAHbVmPyxOJzJkZ1aR=qNKNfz5Y4464e--rF-1GF9=SJZxyVAmg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9 February 2015 at 03:57, Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc Mamin 2015-02-09 10:14:11 Re: Partioning with overlapping and non overlapping constraints
Previous Message Oliver 2015-02-09 08:11:53 Re: Change postgresql encoding