Skip to content

Commit 26cd1d7

Browse files
committed
docs: add results for JSON operator examples
Patch by Sehrope Sarkuni
1 parent 19fa616 commit 26cd1d7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

doc/src/sgml/func.sgml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10099,44 +10099,51 @@ table2-mapping
1009910099
<entry>Right Operand Type</entry>
1010010100
<entry>Description</entry>
1010110101
<entry>Example</entry>
10102+
<entry>Example Result</entry>
1010210103
</row>
1010310104
</thead>
1010410105
<tbody>
1010510106
<row>
1010610107
<entry><literal>-&gt;</literal></entry>
1010710108
<entry>int</entry>
1010810109
<entry>Get JSON array element</entry>
10109-
<entry><literal>'[1,2,3]'::json-&gt;2</literal></entry>
10110+
<entry><literal>'[{"a":"foo"},{"a":"bar"},{"a":"baz"}]'::json-&gt;2</literal></entry>
10111+
<entry><literal>{"a":"baz"}</literal></entry>
1011010112
</row>
1011110113
<row>
1011210114
<entry><literal>-&gt;</literal></entry>
1011310115
<entry>text</entry>
1011410116
<entry>Get JSON object field</entry>
10115-
<entry><literal>'{"a":1,"b":2}'::json-&gt;'b'</literal></entry>
10117+
<entry><literal>'{"a": {"b":"foo"}}'::json-&gt;'a'</literal></entry>
10118+
<entry><literal>{"b":"foo"}</literal></entry>
1011610119
</row>
1011710120
<row>
1011810121
<entry><literal>-&gt;&gt;</literal></entry>
1011910122
<entry>int</entry>
1012010123
<entry>Get JSON array element as text</entry>
1012110124
<entry><literal>'[1,2,3]'::json-&gt;&gt;2</literal></entry>
10125+
<entry><literal>3</literal></entry>
1012210126
</row>
1012310127
<row>
1012410128
<entry><literal>-&gt;&gt;</literal></entry>
1012510129
<entry>text</entry>
1012610130
<entry>Get JSON object field as text</entry>
1012710131
<entry><literal>'{"a":1,"b":2}'::json-&gt;&gt;'b'</literal></entry>
10132+
<entry><literal>2</literal></entry>
1012810133
</row>
1012910134
<row>
1013010135
<entry><literal>#&gt;</literal></entry>
1013110136
<entry>text[]</entry>
10132-
<entry>Get JSON object at specified path</entry>
10133-
<entry><literal>'{"a":[1,2,3],"b":[4,5,6]}'::json#&gt;'{a,2}'</literal></entry>
10137+
<entry>Get JSON object at specified path</entry>
10138+
<entry><literal>'{"a": {"b":{"c": "foo"}}}'::json#&gt;'{a,b}'</literal></entry>
10139+
<entry><literal>{"c": "foo"}</literal></entry>
1013410140
</row>
1013510141
<row>
1013610142
<entry><literal>#&gt;&gt;</literal></entry>
1013710143
<entry>text[]</entry>
1013810144
<entry>Get JSON object at specified path as text</entry>
1013910145
<entry><literal>'{"a":[1,2,3],"b":[4,5,6]}'::json#&gt;&gt;'{a,2}'</literal></entry>
10146+
<entry><literal>3</literal></entry>
1014010147
</row>
1014110148
</tbody>
1014210149
</tgroup>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy