summaryrefslogtreecommitdiff
path: root/doc/src/sgml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/sgml')
-rw-r--r--doc/src/sgml/func.sgml23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index c3b61269438..da138e1fee7 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -10716,6 +10716,19 @@ table2-mapping
</programlisting>
</entry>
</row>
+ <row>
+ <entry><para><literal>json_strip_nulls(from_json json)</literal>
+ </para><para><literal>jsonb_strip_nulls(from_json jsonb)</literal>
+ </para></entry>
+ <entry><para><type>json</type></para><para><type>jsonb</type></para></entry>
+ <entry>
+ Returns <replaceable>from_json</replaceable>
+ with all object fields that have null values omitted. Other null values
+ are untouched.
+ </entry>
+ <entry><literal>json_strip_nulls('[{"f1":1,"f2":null},2,null,3]')</literal></entry>
+ <entry><literal>[{"f1":1},2,null,3]</literal></entry>
+ </row>
</tbody>
</tgroup>
</table>
@@ -10752,6 +10765,16 @@ table2-mapping
</para>
</note>
+ <note>
+ <para>
+ If the argument to <literal>json_strip_nulls</> contains duplicate
+ field names in any object, the result could be semantically somewhat
+ different, depending on the order in which they occur. This is not an
+ issue for <literal>jsonb_strip_nulls</> since jsonb values never have
+ duplicate object field names.
+ </para>
+ </note>
+
<para>
See also <xref linkend="functions-aggregate"> for the aggregate
function <function>json_agg</function> which aggregates record