On Mon, Feb 9, 2015 at 3:07 AM, David Evans wrote:
> On 9 February 2015 at 03:57, Gavin Flower
> 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;
On 9 February 2015 at 03:57, Gavin Flower
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
---+
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
--
> I've noticed that when representing lists as JSON, Postgres 9.4 sometimes
> outputs spaces after commas, and other times does not.
Here is a similar test on 9.3:
# select '[1,2,3]'::json::text, '[1, 2, 3]'::json::text;
text | text
-+---
[1,2,3] | [1, 2, 3]
It looks like
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]
Thi