json_strip_nulls()

2022-01-22 Thread Erwin Brandstetter
The manual says this about json_strip_nulls()[1]: > Deletes all object fields that have null values from the given JSON value, recursively. Null values that are not object fields are untouched. [1] https://www.postgresql.org/docs/current/functions-json.html#FUNCTIONS-JSON-PROCESSING-TABLE

Re: json_strip_nulls()

2022-01-22 Thread David G. Johnston
On Sat, Jan 22, 2022 at 12:11 PM Erwin Brandstetter wrote: > But the function also strips all insignificant white space: > > test=> SELECT json_strip_nulls(json '{"a": 1 , > test'> "foo" : "bar"

Re: json_strip_nulls()

2022-01-22 Thread Erwin Brandstetter
e >> while undocumented. So let's document the behavior: >> > > json_strip_nulls doesn't make any promise regarding its output json other > than that it is valid. Since we are munging the json we are arguably > within our rights to output whatever transformed versi

Re: json_strip_nulls()

2022-01-22 Thread Tom Lane
Erwin Brandstetter writes: > On Sat, 22 Jan 2022 at 20:31, David G. Johnston > wrote: >> json_strip_nulls doesn't make any promise regarding its output json other >> than that it is valid. Since we are munging the json we are arguably >> within our rights to output

Re: json_strip_nulls()

2022-01-22 Thread Erwin Brandstetter
On Sat, 22 Jan 2022 at 22:00, Tom Lane wrote: > Erwin Brandstetter writes: > > On Sat, 22 Jan 2022 at 20:31, David G. Johnston < > david.g.johns...@gmail.com> > > wrote: > >> json_strip_nulls doesn't make any promise regarding its output json > other