Re: Stability of JSON textual representation

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: David Evans <david(dot)evans(at)cantab(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Stability of JSON textual representation
Date: 2015-02-09 03:57:34
Message-ID: 54D8302E.6040705@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/02/15 00:06, David Evans wrote:
> I've noticed that when representing lists as JSON, Postgres 9.4
> sometimes outputs spaces after commas, and other times does not.
>
> # SELECT array_to_json(array[1, 2, 3]), json_build_array(1, 2, 3);
>
> array_to_json | json_build_array
> ---------------+------------------
> [1,2,3] | [1, 2, 3]
>
>
> This matters to me because I'm intending the hash the JSON text and
> use the hash for change detection.
>
> This difference in behaviour doesn't seem to be documented anywhere.
> Does anyone know whether it is likely to be stable?
>
> Many thanks,
>
> Dave
Would using jsonb be more consistent?

Cheers,
Gavin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2015-02-09 06:05:57 Re: dbmsscheduler
Previous Message Paul Jungwirth 2015-02-09 03:49:13 Re: Stability of JSON textual representation