@@ -10095,7 +10095,7 @@ table2-mapping
10095
10095
</entry>
10096
10096
<entry><type>json</type></entry>
10097
10097
<entry>
10098
- Returns JSONobject pointed to by <parameter>path_elems</parameter>.
10098
+ Returns JSONvalue pointed to by <parameter>path_elems</parameter>.
10099
10099
</entry>
10100
10100
<entry><literal>json_extract_path('{"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}','f4')</literal></entry>
10101
10101
<entry><literal>{"f5":99,"f6":"foo"}</literal></entry>
@@ -10109,7 +10109,7 @@ table2-mapping
10109
10109
</entry>
10110
10110
<entry><type>text</type></entry>
10111
10111
<entry>
10112
- Returns JSONobject pointed to by <parameter>path_elems</parameter>.
10112
+ Returns JSONvalue pointed to by <parameter>path_elems</parameter>.
10113
10113
</entry>
10114
10114
<entry><literal>json_extract_path_text('{"f2":{"f3":1},"f4":{"f5":99,"f6":"foo"}}','f4', 'f6')</literal></entry>
10115
10115
<entry><literal>foo</literal></entry>
@@ -10192,7 +10192,7 @@ table2-mapping
10192
10192
</entry>
10193
10193
<entry><type>SETOF json</type></entry>
10194
10194
<entry>
10195
- Expands a JSON array to a set of JSONelements .
10195
+ Expands a JSON array to a set of JSONvalues .
10196
10196
</entry>
10197
10197
<entry><literal>json_array_elements('[1,true, [2,false]]')</literal></entry>
10198
10198
<entry>
@@ -10205,6 +10205,23 @@ table2-mapping
10205
10205
</programlisting>
10206
10206
</entry>
10207
10207
</row>
10208
+ <row>
10209
+ <entry>
10210
+ <indexterm>
10211
+ <primary>json_typeof</primary>
10212
+ </indexterm>
10213
+ <literal>json_typeof(json)</literal>
10214
+ </entry>
10215
+ <entry><type>text</type></entry>
10216
+ <entry>
10217
+ Returns the type of the outermost JSON value as a text string. The types are
10218
+ <literal>object</>, <literal>array</>, <literal>string</>, <literal>number</>,
10219
+ <literal>boolean</>, and <literal>null</>. (See note below regarding the
10220
+ distinction between a JSON <literal>null</> and a SQL NULL.)
10221
+ </entry>
10222
+ <entry><literal>json_typeof('-123.4')</literal></entry>
10223
+ <entry><literal>number</literal></entry>
10224
+ </row>
10208
10225
</tbody>
10209
10226
</tgroup>
10210
10227
</table>
@@ -10237,6 +10254,14 @@ table2-mapping
10237
10254
</para>
10238
10255
</note>
10239
10256
10257
+ <note>
10258
+ <para>
10259
+ The <literal>json_typeof</> function's <literal>null</> return value should not be confused
10260
+ with a SQL NULL. While calling <literal>json_typeof('null'::json)</> will return <literal>null</>,
10261
+ calling <literal>json_typeof(NULL::json)</> will return a SQL NULL.
10262
+ </para>
10263
+ </note>
10264
+
10240
10265
<para>
10241
10266
See also <xref linkend="functions-aggregate"> about the aggregate
10242
10267
function <function>json_agg</function> which aggregates record