This file is indexed.

/usr/share/gtk-doc/html/json-glib/JsonPath.html is in libjson-glib-doc 1.0.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSON-GLib Reference Manual: JsonPath</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="JSON-GLib Reference Manual">
<link rel="up" href="ch02.html" title="Parser">
<link rel="prev" href="JsonReader.html" title="JsonReader">
<link rel="next" href="ch03.html" title="Generator">
<meta name="generator" content="GTK-Doc V1.20 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="10"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span> 
                  <a href="#JsonPath.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span> 
                  <a href="#JsonPath.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="JsonReader.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="ch03.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="JsonPath"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="JsonPath.top_of_page"></a>JsonPath</span></h2>
<p>JsonPath — JSONPath implementation</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="JsonPath.functions"></a><h2>Functions</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="JsonPath.html" title="JsonPath"><span class="returnvalue">JsonPath</span></a> *
</td>
<td class="function_name">
<a class="link" href="JsonPath.html#json-path-new" title="json_path_new ()">json_path_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="JsonPath.html#JSON-PATH-ERROR:CAPS" title="JSON_PATH_ERROR">JSON_PATH_ERROR</a></td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<a class="link" href="JsonPath.html#json-path-compile" title="json_path_compile ()">json_path_compile</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="returnvalue">JsonNode</span></a> *
</td>
<td class="function_name">
<a class="link" href="JsonPath.html#json-path-match" title="json_path_match ()">json_path_match</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="returnvalue">JsonNode</span></a> *
</td>
<td class="function_name">
<a class="link" href="JsonPath.html#json-path-query" title="json_path_query ()">json_path_query</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="JsonPath.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="JsonPath.html#JsonPath-struct" title="JsonPath">JsonPath</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="JsonPath.html#JsonPathClass" title="JsonPathClass">JsonPathClass</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="JsonPath.html#JsonPathError" title="enum JsonPathError">JsonPathError</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="JsonPath.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    GObject
    <span class="lineart">╰──</span> JsonPath
</pre>
</div>
<div class="refsect1">
<a name="JsonPath.description"></a><h2>Description</h2>
<p><a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> is a simple class implementing the JSONPath syntax for extracting
data out of a JSON tree. While the semantics of the JSONPath expressions are
heavily borrowed by the XPath specification for XML, the syntax follows the
ECMAScript origins of JSON.</p>
<p>Once a <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> instance has been created, it has to compile a JSONPath
expression using <a class="link" href="JsonPath.html#json-path-compile" title="json_path_compile ()"><code class="function">json_path_compile()</code></a> before being able to match it to a
JSON tree; the same <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> instance can be used to match multiple JSON
trees. It it also possible to compile a new JSONPath expression using the
same <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> instance; the previous expression will be discarded only if
the compilation of the new expression is successful.</p>
<p>The simple convenience function <a class="link" href="JsonPath.html#json-path-query" title="json_path_query ()"><code class="function">json_path_query()</code></a> can be used for one-off
matching.</p>
<div class="refsect3">
<a name="id-1.4.3.4.6.5"></a><h4>Syntax of the JSONPath expressions</h4>
<p>A JSONPath expression is composed by path indices and operators.
Each path index can either be a member name or an element index inside
a JSON tree. A JSONPath expression must start with the '$' operator; each
path index is separated using either the dot notation or the bracket
notation, e.g.:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc slc">// dot notation</span>
$<span class="gtkdoc opt">.</span>store<span class="gtkdoc opt">.</span>book<span class="gtkdoc opt">[</span><span class="number">0</span><span class="gtkdoc opt">].</span>title

<span class="gtkdoc slc">// bracket notation</span>
$<span class="gtkdoc opt">[</span><span class="string">'store'</span><span class="gtkdoc opt">][</span><span class="string">'book'</span><span class="gtkdoc opt">][</span><span class="number">0</span><span class="gtkdoc opt">][</span><span class="string">'title'</span><span class="gtkdoc opt">]</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>The available operators are:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>Root node
The '$' character represents the root node of the JSON tree, and
matches the entire document.</p></li>
<li class="listitem"><p>Child nodes can either be matched using '.' or '[]'. For instance,
both <code class="literal">$.store.book</code> and `$'store' match the contents of
the book member of the store object.</p></li>
<li class="listitem"><p>Child nodes can be reached without specifying the whole tree structure
through the recursive descent operator, or '..'. For instance,
<code class="literal">$..author</code> matches all author member in every object.</p></li>
<li class="listitem"><p>Child nodes can grouped through the wildcard operator, or '*'. For
instance, <code class="literal">$.store.book[*].author</code> matches all author members of any
object element contained in the book array of the store object.</p></li>
<li class="listitem"><p>Element nodes can be accessed using their index (starting from zero)
in the subscript operator '[]'. For instance, <code class="literal">$.store.book[0]</code> matches
the first element of the book array of the store object.</p></li>
<li class="listitem"><p>Subsets of element nodes can be accessed using the set notation
operator '[start,end]'. For instance, <code class="literal">$.store.book[0,2]</code> matches the
first, second, and third elements of the book array of the store
object.</p></li>
<li class="listitem"><p>Slices of element nodes can be accessed using the slice notation
operation '[start:end:step]'. If start is omitted, the starting index
of the slice is implied to be zero; if end is omitted, the ending index
of the slice is implied to be the length of the array; if step is
omitted, the step of the slice is implied to be 1. For instance,
<code class="literal">$.store.book[:2]</code> matches the first two elements of the book array
of the store object.</p></li>
</ul></div>
<p>More information about JSONPath is available on Stefan Gössner's
<a class="ulink" href="http://goessner.net/articles/JsonPath/" target="_top">JSONPath website</a>.</p>
</div>
<div class="refsect3">
<a name="id-1.4.3.4.6.6"></a><h4>Example of JSONPath matches</h4>
<p>The following example shows some of the results of using <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a>
on a JSON tree. We use the following JSON description of a bookstore:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc opt">{</span> <span class="string">&quot;store&quot;</span><span class="gtkdoc opt">: {</span>
    <span class="string">&quot;book&quot;</span><span class="gtkdoc opt">: [</span>
      <span class="gtkdoc opt">{</span> <span class="string">&quot;category&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;reference&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;author&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;Nigel Rees&quot;</span><span class="gtkdoc opt">,</span>
        <span class="string">&quot;title&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;Sayings of the Century&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;price&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;8.95&quot;</span>  <span class="gtkdoc opt">},</span>
      <span class="gtkdoc opt">{</span> <span class="string">&quot;category&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;fiction&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;author&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;Evelyn Waugh&quot;</span><span class="gtkdoc opt">,</span>
        <span class="string">&quot;title&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;Sword of Honour&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;price&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;12.99&quot;</span> <span class="gtkdoc opt">},</span>
      <span class="gtkdoc opt">{</span> <span class="string">&quot;category&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;fiction&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;author&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;Herman Melville&quot;</span><span class="gtkdoc opt">,</span>
        <span class="string">&quot;title&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;Moby Dick&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;isbn&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;0-553-21311-3&quot;</span><span class="gtkdoc opt">,</span>
        <span class="string">&quot;price&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;8.99&quot;</span> <span class="gtkdoc opt">},</span>
      <span class="gtkdoc opt">{</span> <span class="string">&quot;category&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;fiction&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;author&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;J. R. R. Tolkien&quot;</span><span class="gtkdoc opt">,</span>
        <span class="string">&quot;title&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;The Lord of the Rings&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;isbn&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;0-395-19395-8&quot;</span><span class="gtkdoc opt">,</span>
        <span class="string">&quot;price&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;22.99&quot;</span> <span class="gtkdoc opt">}</span>
    <span class="gtkdoc opt">],</span>
    <span class="string">&quot;bicycle&quot;</span><span class="gtkdoc opt">: {</span> <span class="string">&quot;color&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;red&quot;</span><span class="gtkdoc opt">,</span> <span class="string">&quot;price&quot;</span><span class="gtkdoc opt">:</span> <span class="string">&quot;19.95&quot;</span> <span class="gtkdoc opt">}</span>
  <span class="gtkdoc opt">}</span>
<span class="gtkdoc opt">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>We can parse the JSON using <a class="link" href="JsonParser.html" title="JsonParser"><span class="type">JsonParser</span></a>:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2</pre></td>
        <td class="listing_code"><pre class="programlisting">JsonParser <span class="gtkdoc opt">*</span>parser <span class="gtkdoc opt">=</span> <span class="function"><a href="JsonParser.html#json-parser-new">json_parser_new</a></span> <span class="gtkdoc opt">();</span>
<span class="function"><a href="JsonParser.html#json-parser-load-from-data">json_parser_load_from_data</a></span> <span class="gtkdoc opt">(</span>parser<span class="gtkdoc opt">,</span> json_data<span class="gtkdoc opt">, -</span><span class="number">1</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>If we run the following code:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4</pre></td>
        <td class="listing_code"><pre class="programlisting">JsonNode <span class="gtkdoc opt">*</span>result<span class="gtkdoc opt">;</span>
JsonPath <span class="gtkdoc opt">*</span>path <span class="gtkdoc opt">=</span> <span class="function"><a href="JsonPath.html#json-path-new">json_path_new</a></span> <span class="gtkdoc opt">();</span>
<span class="function"><a href="JsonPath.html#json-path-compile">json_path_compile</a></span> <span class="gtkdoc opt">(</span>path<span class="gtkdoc opt">,</span> <span class="string">&quot;$.store..author&quot;</span><span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
result <span class="gtkdoc opt">=</span> <span class="function"><a href="JsonPath.html#json-path-match">json_path_match</a></span> <span class="gtkdoc opt">(</span>path<span class="gtkdoc opt">,</span> <span class="function"><a href="JsonParser.html#json-parser-get-root">json_parser_get_root</a></span> <span class="gtkdoc opt">(</span>parser<span class="gtkdoc opt">));</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>The result <a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="type">JsonNode</span></a> will contain an array with all values of the
author member of the objects in the JSON tree. If we use a
<a class="link" href="JsonGenerator.html" title="JsonGenerator"><span class="type">JsonGenerator</span></a> to convert the <a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="type">JsonNode</span></a> to a string and print it:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4</pre></td>
        <td class="listing_code"><pre class="programlisting">JsonGenerator <span class="gtkdoc opt">*</span>generator <span class="gtkdoc opt">=</span> <span class="function"><a href="JsonGenerator.html#json-generator-new">json_generator_new</a></span> <span class="gtkdoc opt">();</span>
<span class="function"><a href="JsonGenerator.html#json-generator-set-root">json_generator_set_root</a></span> <span class="gtkdoc opt">(</span>generator<span class="gtkdoc opt">,</span> result<span class="gtkdoc opt">);</span>
<span class="gtkdoc kwb">char</span> <span class="gtkdoc opt">*</span>str <span class="gtkdoc opt">=</span> <span class="function"><a href="JsonGenerator.html#json-generator-to-data">json_generator_to_data</a></span> <span class="gtkdoc opt">(</span>generator<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">);</span>
<span class="function">g_print</span> <span class="gtkdoc opt">(</span><span class="string">&quot;Results: %s</span><span class="gtkdoc esc">\n</span><span class="string">&quot;</span><span class="gtkdoc opt">,</span> str<span class="gtkdoc opt">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>The output will be:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc opt">[</span><span class="string">&quot;Nigel Rees&quot;</span><span class="gtkdoc opt">,</span><span class="string">&quot;Evelyn Waugh&quot;</span><span class="gtkdoc opt">,</span><span class="string">&quot;Herman Melville&quot;</span><span class="gtkdoc opt">,</span><span class="string">&quot;J. R. R. Tolkien&quot;</span><span class="gtkdoc opt">]</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p><a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> is available since JSON-GLib 0.14</p>
</div>
</div>
<div class="refsect1">
<a name="JsonPath.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="json-path-new"></a><h3>json_path_new ()</h3>
<pre class="programlisting"><a class="link" href="JsonPath.html" title="JsonPath"><span class="returnvalue">JsonPath</span></a> *
json_path_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Creates a new <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> instance.</p>
<p>Once created, the <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> object should be used with <a class="link" href="JsonPath.html#json-path-compile" title="json_path_compile ()"><code class="function">json_path_compile()</code></a>
and <a class="link" href="JsonPath.html#json-path-match" title="json_path_match ()"><code class="function">json_path_match()</code></a>.</p>
<div class="refsect3">
<a name="id-1.4.3.4.7.2.6"></a><h4>Returns</h4>
<p> the newly created <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> instance. Use
<code class="function">g_object_unref()</code> to free the allocated resources when done. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since 0.14</p>
</div>
<hr>
<div class="refsect2">
<a name="JSON-PATH-ERROR:CAPS"></a><h3>JSON_PATH_ERROR</h3>
<pre class="programlisting">#define JSON_PATH_ERROR         (json_path_error_quark ())
</pre>
<p>Error domain for <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> errors</p>
<p class="since">Since 0.14</p>
</div>
<hr>
<div class="refsect2">
<a name="json-path-compile"></a><h3>json_path_compile ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
json_path_compile (<em class="parameter"><code><a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> *path</code></em>,
                   <em class="parameter"><code>const <span class="type">char</span> *expression</code></em>,
                   <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Validates and decomposes <em class="parameter"><code>expression</code></em>
.</p>
<p>A JSONPath expression must be compiled before calling <a class="link" href="JsonPath.html#json-path-match" title="json_path_match ()"><code class="function">json_path_match()</code></a>.</p>
<div class="refsect3">
<a name="id-1.4.3.4.7.4.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>a <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>expression</p></td>
<td class="parameter_description"><p>a JSONPath expression</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <span class="type">GError</span>, or <code class="literal">NULL</code></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.3.4.7.4.7"></a><h4>Returns</h4>
<p> <code class="literal">TRUE</code> on success; on error, <em class="parameter"><code>error</code></em>
will be set with
the <a class="link" href="JsonPath.html#JSON-PATH-ERROR:CAPS" title="JSON_PATH_ERROR"><code class="literal">JSON_PATH_ERROR</code></a> domain and a code from the <a class="link" href="JsonPath.html#JsonPathError" title="enum JsonPathError"><span class="type">JsonPathError</span></a>
enumeration, and <code class="literal">FALSE</code> will be returned</p>
<p></p>
</div>
<p class="since">Since 0.14</p>
</div>
<hr>
<div class="refsect2">
<a name="json-path-match"></a><h3>json_path_match ()</h3>
<pre class="programlisting"><a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="returnvalue">JsonNode</span></a> *
json_path_match (<em class="parameter"><code><a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> *path</code></em>,
                 <em class="parameter"><code><a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="type">JsonNode</span></a> *root</code></em>);</pre>
<p>Matches the JSON tree pointed by <em class="parameter"><code>root</code></em>
 using the expression compiled
into the <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a>.</p>
<p>The matching <a href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNodes</span></a> will be copied into a <a class="link" href="json-glib-JSON-Array.html#JsonArray" title="JsonArray"><span class="type">JsonArray</span></a> and
returned wrapped in a <a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="type">JsonNode</span></a>.</p>
<div class="refsect3">
<a name="id-1.4.3.4.7.5.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description"><p>a compiled <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>root</p></td>
<td class="parameter_description"><p>a <a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="type">JsonNode</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.3.4.7.5.7"></a><h4>Returns</h4>
<p> a newly-created <a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="type">JsonNode</span></a> of type
<a class="link" href="json-glib-JSON-Node.html#JSON-NODE-ARRAY:CAPS"><code class="literal">JSON_NODE_ARRAY</code></a> containing an array of matching <a href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNodes</span></a>.
Use <a class="link" href="json-glib-JSON-Node.html#json-node-free" title="json_node_free ()"><code class="function">json_node_free()</code></a> when done. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since 0.14</p>
</div>
<hr>
<div class="refsect2">
<a name="json-path-query"></a><h3>json_path_query ()</h3>
<pre class="programlisting"><a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="returnvalue">JsonNode</span></a> *
json_path_query (<em class="parameter"><code>const <span class="type">char</span> *expression</code></em>,
                 <em class="parameter"><code><a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="type">JsonNode</span></a> *root</code></em>,
                 <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
<p>Queries a JSON tree using a JSONPath expression.</p>
<p>This function is a simple wrapper around <a class="link" href="JsonPath.html#json-path-new" title="json_path_new ()"><code class="function">json_path_new()</code></a>,
<a class="link" href="JsonPath.html#json-path-compile" title="json_path_compile ()"><code class="function">json_path_compile()</code></a> and <a class="link" href="JsonPath.html#json-path-match" title="json_path_match ()"><code class="function">json_path_match()</code></a>. It implicitly
creates a <a class="link" href="JsonPath.html" title="JsonPath"><span class="type">JsonPath</span></a> instance, compiles <em class="parameter"><code>expression</code></em>
 and
matches it against the JSON tree pointed by <em class="parameter"><code>root</code></em>
.</p>
<div class="refsect3">
<a name="id-1.4.3.4.7.6.6"></a><h4>Parameters</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>expression</p></td>
<td class="parameter_description"><p>a JSONPath expression</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>root</p></td>
<td class="parameter_description"><p>the root of a JSON tree</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for a <span class="type">GError</span>, or <code class="literal">NULL</code></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="id-1.4.3.4.7.6.7"></a><h4>Returns</h4>
<p> a newly-created <a class="link" href="json-glib-JSON-Node.html#JsonNode" title="JsonNode"><span class="type">JsonNode</span></a> of type
<a class="link" href="json-glib-JSON-Node.html#JSON-NODE-ARRAY:CAPS"><code class="literal">JSON_NODE_ARRAY</code></a> containing an array of matching <a href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNodes</span></a>.
Use <a class="link" href="json-glib-JSON-Node.html#json-node-free" title="json_node_free ()"><code class="function">json_node_free()</code></a> when done. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
<p class="since">Since 0.14</p>
</div>
</div>
<div class="refsect1">
<a name="JsonPath.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="JsonPath-struct"></a><h3>JsonPath</h3>
<pre class="programlisting">typedef struct _JsonPath JsonPath;</pre>
<p>The <code class="literal">JsonPath</code> structure is an opaque object whose members cannot be
directly accessed except through the provided API.</p>
<p class="since">Since 0.14</p>
</div>
<hr>
<div class="refsect2">
<a name="JsonPathClass"></a><h3>JsonPathClass</h3>
<pre class="programlisting">typedef struct _JsonPathClass JsonPathClass;</pre>
<p>The <code class="literal">JsonPathClass</code> structure is an opaque object class whose members
cannot be directly accessed.</p>
<p class="since">Since 0.14</p>
</div>
<hr>
<div class="refsect2">
<a name="JsonPathError"></a><h3>enum JsonPathError</h3>
<p>Error code enumeration for the <a class="link" href="JsonPath.html#JSON-PATH-ERROR:CAPS" title="JSON_PATH_ERROR"><code class="literal">JSON_PATH_ERROR</code></a> domain.</p>
<div class="refsect3">
<a name="id-1.4.3.4.8.4.4"></a><h4>Members</h4>
<div class="informaltable"><table width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody><tr>
<td class="enum_member_name"><p><a name="JSON-PATH-ERROR-INVALID-QUERY:CAPS"></a>JSON_PATH_ERROR_INVALID_QUERY</p></td>
<td class="enum_member_description">
<p>Invalid query</p>
</td>
<td class="enum_member_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since 0.14</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.20</div>
</body>
</html>