Re: to_json(NULL) should to return JSON null instead NULL

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: to_json(NULL) should to return JSON null instead NULL
Date: 2015-08-29 20:08:50
Message-ID: CAFj8pRBPHDzz4L99eKyzXuFfZWKd1=G_zYAWRsvY95R3w+SiOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2015-08-29 22:06 GMT+02:00 Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>:

> On 8/29/15 12:29 PM, Pavel Stehule wrote:
>
>> Note that all the to_json functions are strict. In this sense it's
>> quite consistent. If we change it to being called on null input,
>> what should we return if a null non-scalar is passed in?
>>
>>
>> what is correct from JSON perspective? All fields with NULL
>>
>
> ISTM that the whole purpose of to_json is to properly jsonify something,
> and the proper json form for "undefined" is 'null', is it not?

it is probably equivalent

Pavel

>
> --
> Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
> Experts in Analytics, Data Architecture and PostgreSQL
> Data in Trouble? Get it in Treble! http://BlueTreble.com
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-08-29 20:27:10 Re: to_json(NULL) should to return JSON null instead NULL
Previous Message Jim Nasby 2015-08-29 20:06:32 Re: to_json(NULL) should to return JSON null instead NULL