Imported Upstream version 1.2.4
[platform/upstream/json-glib.git] / doc / reference / html / json-glib-Utility-API.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Utility API: JSON-GLib Reference Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="JSON-GLib Reference Manual">
8 <link rel="up" href="ch04.html" title="General Purpose API">
9 <link rel="prev" href="ch04.html" title="General Purpose API">
10 <link rel="next" href="json-advanced.html" title="Part IV. JSON-GLib Advanced API">
11 <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
13 </head>
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
18                   <a href="#json-glib-Utility-API.description" class="shortcut">Description</a></span>
19 </td>
20 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
21 <td><a accesskey="u" href="ch04.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
22 <td><a accesskey="p" href="ch04.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
23 <td><a accesskey="n" href="json-advanced.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
24 </tr></table>
25 <div class="refentry">
26 <a name="json-glib-Utility-API"></a><div class="titlepage"></div>
27 <div class="refnamediv"><table width="100%"><tr>
28 <td valign="top">
29 <h2><span class="refentrytitle"><a name="json-glib-Utility-API.top_of_page"></a>Utility API</span></h2>
30 <p>Utility API — Various utility functions</p>
31 </td>
32 <td class="gallery_image" valign="top" align="right"></td>
33 </tr></table></div>
34 <div class="refsect1">
35 <a name="json-glib-Utility-API.functions"></a><h2>Functions</h2>
36 <div class="informaltable"><table class="informaltable" width="100%" border="0">
37 <colgroup>
38 <col width="150px" class="functions_return">
39 <col class="functions_name">
40 </colgroup>
41 <tbody>
42 <tr>
43 <td class="function_type">
44 <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="returnvalue">JsonNode</span></a> *
45 </td>
46 <td class="function_name">
47 <a class="link" href="json-glib-Utility-API.html#json-from-string" title="json_from_string ()">json_from_string</a> <span class="c_punctuation">()</span>
48 </td>
49 </tr>
50 <tr>
51 <td class="function_type">
52 <span class="returnvalue">char</span> *
53 </td>
54 <td class="function_name">
55 <a class="link" href="json-glib-Utility-API.html#json-to-string" title="json_to_string ()">json_to_string</a> <span class="c_punctuation">()</span>
56 </td>
57 </tr>
58 </tbody>
59 </table></div>
60 </div>
61 <div class="refsect1">
62 <a name="json-glib-Utility-API.description"></a><h2>Description</h2>
63 <p>Various utility functions.</p>
64 </div>
65 <div class="refsect1">
66 <a name="json-glib-Utility-API.functions_details"></a><h2>Functions</h2>
67 <div class="refsect2">
68 <a name="json-from-string"></a><h3>json_from_string ()</h3>
69 <pre class="programlisting"><a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="returnvalue">JsonNode</span></a> *
70 json_from_string (<em class="parameter"><code>const <span class="type">char</span> *str</code></em>,
71                   <em class="parameter"><code><span class="type">GError</span> **error</code></em>);</pre>
72 <p>Parses the string in <em class="parameter"><code>str</code></em>
73  and returns a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> representing
74 the JSON tree.</p>
75 <p>In case of parsing error, this function returns <code class="literal">NULL</code> and sets
76 <em class="parameter"><code>error</code></em>
77  appropriately.</p>
78 <div class="refsect3">
79 <a name="json-from-string.parameters"></a><h4>Parameters</h4>
80 <div class="informaltable"><table class="informaltable" width="100%" border="0">
81 <colgroup>
82 <col width="150px" class="parameters_name">
83 <col class="parameters_description">
84 <col width="200px" class="parameters_annotations">
85 </colgroup>
86 <tbody>
87 <tr>
88 <td class="parameter_name"><p>str</p></td>
89 <td class="parameter_description"><p>a valid UTF-8 string containing JSON data</p></td>
90 <td class="parameter_annotations"> </td>
91 </tr>
92 <tr>
93 <td class="parameter_name"><p>error</p></td>
94 <td class="parameter_description"><p>return location for a <span class="type">GError</span></p></td>
95 <td class="parameter_annotations"> </td>
96 </tr>
97 </tbody>
98 </table></div>
99 </div>
100 <div class="refsect3">
101 <a name="json-from-string.returns"></a><h4>Returns</h4>
102 <p> a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a>, or <code class="literal">NULL</code>. </p>
103 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
104 </div>
105 <p class="since">Since: <a class="link" href="ix11.html#api-index-1.2">1.2</a></p>
106 </div>
107 <hr>
108 <div class="refsect2">
109 <a name="json-to-string"></a><h3>json_to_string ()</h3>
110 <pre class="programlisting"><span class="returnvalue">char</span> *
111 json_to_string (<em class="parameter"><code><a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a> *node</code></em>,
112                 <em class="parameter"><code><span class="type">gboolean</span> pretty</code></em>);</pre>
113 <p>Generates a stringified JSON representation of the contents of
114 the passed <em class="parameter"><code>node</code></em>
115 .</p>
116 <div class="refsect3">
117 <a name="json-to-string.parameters"></a><h4>Parameters</h4>
118 <div class="informaltable"><table class="informaltable" width="100%" border="0">
119 <colgroup>
120 <col width="150px" class="parameters_name">
121 <col class="parameters_description">
122 <col width="200px" class="parameters_annotations">
123 </colgroup>
124 <tbody>
125 <tr>
126 <td class="parameter_name"><p>node</p></td>
127 <td class="parameter_description"><p>a <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a></p></td>
128 <td class="parameter_annotations"> </td>
129 </tr>
130 <tr>
131 <td class="parameter_name"><p>pretty</p></td>
132 <td class="parameter_description"><p>whether the output should be prettyfied for printing</p></td>
133 <td class="parameter_annotations"> </td>
134 </tr>
135 </tbody>
136 </table></div>
137 </div>
138 <div class="refsect3">
139 <a name="json-to-string.returns"></a><h4>Returns</h4>
140 <p> the string representation of the <a class="link" href="json-glib-JSON-Node.html#JsonNode"><span class="type">JsonNode</span></a>. </p>
141 <p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
142 </div>
143 <p class="since">Since: <a class="link" href="ix11.html#api-index-1.2">1.2</a></p>
144 </div>
145 </div>
146 <div class="refsect1">
147 <a name="json-glib-Utility-API.other_details"></a><h2>Types and Values</h2>
148 </div>
149 </div>
150 <div class="footer">
151 <hr>Generated by GTK-Doc V1.25.1</div>
152 </body>
153 </html>