1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 5 <meta http-equiv="X-UA-Compatible" content="IE=9"/> 6 <title>json-c: /home/erh/json-c-0.15/json_tokener.h File Reference</title> 7 <link href="tabs.css" rel="stylesheet" type="text/css"/> 8 <script type="text/javascript" src="jquery.js"></script> 9 <script type="text/javascript" src="dynsections.js"></script> 10 <link href="doxygen.css" rel="stylesheet" type="text/css" /> 11 </head> 12 <body> 13 <div id="top"><!-- do not remove this div, it is closed by doxygen! --> 14 <div id="titlearea"> 15 <table cellspacing="0" cellpadding="0"> 16 <tbody> 17 <tr style="height: 56px;"> 18 <td style="padding-left: 0.5em;"> 19 <div id="projectname">json-c 20  <span id="projectnumber">0.15</span> 21 </div> 22 </td> 23 </tr> 24 </tbody> 25 </table> 26 </div> 27 <!-- end header part --> 28 <!-- Generated by Doxygen 1.8.2 --> 29 <div id="navrow1" class="tabs"> 30 <ul class="tablist"> 31 <li><a href="index.html"><span>Main Page</span></a></li> 32 <li><a href="pages.html"><span>Related Pages</span></a></li> 33 <li><a href="annotated.html"><span>Data Structures</span></a></li> 34 <li class="current"><a href="files.html"><span>Files</span></a></li> 35 </ul> 36 </div> 37 <div id="navrow2" class="tabs2"> 38 <ul class="tablist"> 39 <li><a href="files.html"><span>File List</span></a></li> 40 <li><a href="globals.html"><span>Globals</span></a></li> 41 </ul> 42 </div> 43 <div id="nav-path" class="navpath"> 44 <ul> 45 <li class="navelem"><a class="el" href="dir_71f13e590eb9d766c31051438785ada5.html">json-c-0.15</a></li> </ul> 46 </div> 47 </div><!-- top --> 48 <div class="header"> 49 <div class="summary"> 50 <a href="#nested-classes">Data Structures</a> | 51 <a href="#define-members">Macros</a> | 52 <a href="#typedef-members">Typedefs</a> | 53 <a href="#enum-members">Enumerations</a> | 54 <a href="#func-members">Functions</a> </div> 55 <div class="headertitle"> 56 <div class="title">json_tokener.h File Reference</div> </div> 57 </div><!--header--> 58 <div class="contents"> 59 60 <p>Methods to parse an input string into a tree of json_object objects. 61 <a href="#details">More...</a></p> 62 <table class="memberdecls"> 63 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> 64 Data Structures</h2></td></tr> 65 <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structjson__tokener__srec.html">json_tokener_srec</a></td></tr> 66 <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> 67 <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structjson__tokener.html">json_tokener</a></td></tr> 68 <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> 69 </table><table class="memberdecls"> 70 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a> 71 Macros</h2></td></tr> 72 <tr class="memitem:a5ccd346459feb66e4e0af32005360279"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a5ccd346459feb66e4e0af32005360279">JSON_TOKENER_DEFAULT_DEPTH</a>   32</td></tr> 73 <tr class="separator:a5ccd346459feb66e4e0af32005360279"><td class="memSeparator" colspan="2"> </td></tr> 74 <tr class="memitem:a72be595cb7e090c70b1d29feb1cbfb16"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a72be595cb7e090c70b1d29feb1cbfb16">JSON_TOKENER_STRICT</a>   0x01</td></tr> 75 <tr class="separator:a72be595cb7e090c70b1d29feb1cbfb16"><td class="memSeparator" colspan="2"> </td></tr> 76 <tr class="memitem:aa74428c9cf57655eea5b49feae3f2704"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#aa74428c9cf57655eea5b49feae3f2704">JSON_TOKENER_ALLOW_TRAILING_CHARS</a>   0x02</td></tr> 77 <tr class="separator:aa74428c9cf57655eea5b49feae3f2704"><td class="memSeparator" colspan="2"> </td></tr> 78 <tr class="memitem:a633ab043f2b07fd22420af2b369a260a"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a633ab043f2b07fd22420af2b369a260a">JSON_TOKENER_VALIDATE_UTF8</a>   0x10</td></tr> 79 <tr class="separator:a633ab043f2b07fd22420af2b369a260a"><td class="memSeparator" colspan="2"> </td></tr> 80 </table><table class="memberdecls"> 81 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="typedef-members"></a> 82 Typedefs</h2></td></tr> 83 <tr class="memitem:a4dd5e5b65aee7f376f529f86b210ff49"><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structjson__tokener.html">json_tokener</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a4dd5e5b65aee7f376f529f86b210ff49">json_tokener</a></td></tr> 84 <tr class="separator:a4dd5e5b65aee7f376f529f86b210ff49"><td class="memSeparator" colspan="2"> </td></tr> 85 </table><table class="memberdecls"> 86 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a> 87 Enumerations</h2></td></tr> 88 <tr class="memitem:a0a31f0df8a532ef8be5c09ba40eacb59"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59">json_tokener_error</a> { <br/> 89   <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59afe2fa9bde03155019b2df30f66a5fcd0">json_tokener_success</a>, 90 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a9b26e920ca765df91c84e999561d8fb0">json_tokener_continue</a>, 91 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a59b2c36d9cc30c3038e09b9ddee6c86c">json_tokener_error_depth</a>, 92 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a8f774f4c7869afdd9b92295fca3a9ded">json_tokener_error_parse_eof</a>, 93 <br/> 94   <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a3309fa8ea4ab3ee0a81c55b69d223710">json_tokener_error_parse_unexpected</a>, 95 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a641bbb8d881fdd1e463f20a1a203b77c">json_tokener_error_parse_null</a>, 96 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59addbdfe084e20709da3d20c8ae8ca278c">json_tokener_error_parse_boolean</a>, 97 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59ab1b3ad685eb97235d269cc5b9eb7ab81">json_tokener_error_parse_number</a>, 98 <br/> 99   <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a574846740b785146f164a209dc89574e">json_tokener_error_parse_array</a>, 100 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a2003bd8e96c6680cd22419c5ceafd4c0">json_tokener_error_parse_object_key_name</a>, 101 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59af91a2a819b0d6344d6d4e1d2579f28fd">json_tokener_error_parse_object_key_sep</a>, 102 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a9ddb98741aebf7ac44735b4a43717013">json_tokener_error_parse_object_value_sep</a>, 103 <br/> 104   <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a033ce89ce7b8f9e591e4bea92121c4c7">json_tokener_error_parse_string</a>, 105 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a3588c05b1da8b909a8cbdef66b0a1a28">json_tokener_error_parse_comment</a>, 106 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59ab405d4a1282f3b037048d3456869a4c1">json_tokener_error_parse_utf8_string</a>, 107 <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a1eeed74de65c0c12c9f9c28cf4f3ff1d">json_tokener_error_size</a> 108 <br/> 109 }</td></tr> 110 <tr class="separator:a0a31f0df8a532ef8be5c09ba40eacb59"><td class="memSeparator" colspan="2"> </td></tr> 111 <tr class="memitem:af026dec71e4548e6200eb2f902f1c4e2"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2">json_tokener_state</a> { <br/> 112   <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a9db152607ec1872a000f1fcd8757297d">json_tokener_state_eatws</a>, 113 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a7c4c0bed1ebde45f5a99de4278792d72">json_tokener_state_start</a>, 114 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2ad80b689cb709967b67a348de3d8601d2">json_tokener_state_finish</a>, 115 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a668fb2654c59608945370003403a5792">json_tokener_state_null</a>, 116 <br/> 117   <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a0ff1d1935d49188aa1e6b998d43e655c">json_tokener_state_comment_start</a>, 118 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a8c2680b8873a8dce85f0b1ac25882dc9">json_tokener_state_comment</a>, 119 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2ad8151350b1ef50298bafbab244ac1162">json_tokener_state_comment_eol</a>, 120 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a62cef297a37a98b1239ea4bbd39723e1">json_tokener_state_comment_end</a>, 121 <br/> 122   <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2aa90ea4c327a285bfbbce49d42d491d65">json_tokener_state_string</a>, 123 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a1cf793d73587f68c4f2b3b4f65ff728e">json_tokener_state_string_escape</a>, 124 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a6c852da2e694be56799c58c201d6dca0">json_tokener_state_escape_unicode</a>, 125 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a482827c786d2378635ef54dc2b092264">json_tokener_state_escape_unicode_need_escape</a>, 126 <br/> 127   <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a5cab1cdfea9128e0ed9db85ffdc71df4">json_tokener_state_escape_unicode_need_u</a>, 128 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a3525b15ecd0a698281b3914115b6bd3e">json_tokener_state_boolean</a>, 129 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a7ce18d281d322af690b45f3b8b599e81">json_tokener_state_number</a>, 130 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2ab3d763300f1914865be09d603ddc11f4">json_tokener_state_array</a>, 131 <br/> 132   <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2aa2a01798ebe318ea91c38a886418f771">json_tokener_state_array_add</a>, 133 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a4ec7762aeab3424cbb14354c94025865">json_tokener_state_array_sep</a>, 134 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a8c7dbda177a5d83a36a64f7cb99b9a29">json_tokener_state_object_field_start</a>, 135 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a77375940a10806e81d99876d13be67fc">json_tokener_state_object_field</a>, 136 <br/> 137   <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a0220aea1d9204aadfffde92c7f73f5f7">json_tokener_state_object_field_end</a>, 138 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a4c7b7deac37355491572f6da84f208aa">json_tokener_state_object_value</a>, 139 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2ade6bee72f2147e634b19eb84e58eb162">json_tokener_state_object_value_add</a>, 140 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2adaf3e06c5fc04fd4f04040cd67698215">json_tokener_state_object_sep</a>, 141 <br/> 142   <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2ab1a0ad626ec662c1ba4fb5bfee1cd0a9">json_tokener_state_array_after_sep</a>, 143 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2a3a2c9cf26d076936a10a6ae3ca4eb523">json_tokener_state_object_field_start_after_sep</a>, 144 <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2ab9f6244bfca4924db61ed3050c780b53">json_tokener_state_inf</a> 145 <br/> 146 }</td></tr> 147 <tr class="separator:af026dec71e4548e6200eb2f902f1c4e2"><td class="memSeparator" colspan="2"> </td></tr> 148 </table><table class="memberdecls"> 149 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a> 150 Functions</h2></td></tr> 151 <tr class="memitem:a4a2fa28d815f8b370cbb00b80ebc0f1d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a4a2fa28d815f8b370cbb00b80ebc0f1d">json_tokener_get_parse_end</a> (struct <a class="el" href="structjson__tokener.html">json_tokener</a> *tok)</td></tr> 152 <tr class="separator:a4a2fa28d815f8b370cbb00b80ebc0f1d"><td class="memSeparator" colspan="2"> </td></tr> 153 <tr class="memitem:af060dd6b593b3b710044bcb97dcec07f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> const char * </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#af060dd6b593b3b710044bcb97dcec07f">json_tokener_error_desc</a> (enum <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59">json_tokener_error</a> jerr)</td></tr> 154 <tr class="separator:af060dd6b593b3b710044bcb97dcec07f"><td class="memSeparator" colspan="2"> </td></tr> 155 <tr class="memitem:af5d7ffd95a0f6e5d5bb5994d233b4197"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> enum <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59">json_tokener_error</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#af5d7ffd95a0f6e5d5bb5994d233b4197">json_tokener_get_error</a> (struct <a class="el" href="structjson__tokener.html">json_tokener</a> *tok)</td></tr> 156 <tr class="separator:af5d7ffd95a0f6e5d5bb5994d233b4197"><td class="memSeparator" colspan="2"> </td></tr> 157 <tr class="memitem:a5ac7e2c350bc592cf2fa7b9935b00ef5"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> struct <a class="el" href="structjson__tokener.html">json_tokener</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a5ac7e2c350bc592cf2fa7b9935b00ef5">json_tokener_new</a> (void)</td></tr> 158 <tr class="separator:a5ac7e2c350bc592cf2fa7b9935b00ef5"><td class="memSeparator" colspan="2"> </td></tr> 159 <tr class="memitem:a6a1583ddd434e13515d6232de813462e"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> struct <a class="el" href="structjson__tokener.html">json_tokener</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a6a1583ddd434e13515d6232de813462e">json_tokener_new_ex</a> (int depth)</td></tr> 160 <tr class="separator:a6a1583ddd434e13515d6232de813462e"><td class="memSeparator" colspan="2"> </td></tr> 161 <tr class="memitem:a887c4661906fc6b36cc366304e522534"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> void </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a887c4661906fc6b36cc366304e522534">json_tokener_free</a> (struct <a class="el" href="structjson__tokener.html">json_tokener</a> *tok)</td></tr> 162 <tr class="separator:a887c4661906fc6b36cc366304e522534"><td class="memSeparator" colspan="2"> </td></tr> 163 <tr class="memitem:a238649a59737be5152d525aeaf4153ab"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> void </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a238649a59737be5152d525aeaf4153ab">json_tokener_reset</a> (struct <a class="el" href="structjson__tokener.html">json_tokener</a> *tok)</td></tr> 164 <tr class="separator:a238649a59737be5152d525aeaf4153ab"><td class="memSeparator" colspan="2"> </td></tr> 165 <tr class="memitem:a236ef64d079822a4411d13eae7190c4d"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a236ef64d079822a4411d13eae7190c4d">json_tokener_parse</a> (const char *str)</td></tr> 166 <tr class="separator:a236ef64d079822a4411d13eae7190c4d"><td class="memSeparator" colspan="2"> </td></tr> 167 <tr class="memitem:a735f2dc755d57ed5c5b807aaaaef3b14"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a735f2dc755d57ed5c5b807aaaaef3b14">json_tokener_parse_verbose</a> (const char *str, enum <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59">json_tokener_error</a> *error)</td></tr> 168 <tr class="separator:a735f2dc755d57ed5c5b807aaaaef3b14"><td class="memSeparator" colspan="2"> </td></tr> 169 <tr class="memitem:a7e7a0c0c9dc79e5e47b2608bb8aad7b7"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> void </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a7e7a0c0c9dc79e5e47b2608bb8aad7b7">json_tokener_set_flags</a> (struct <a class="el" href="structjson__tokener.html">json_tokener</a> *tok, int flags)</td></tr> 170 <tr class="separator:a7e7a0c0c9dc79e5e47b2608bb8aad7b7"><td class="memSeparator" colspan="2"> </td></tr> 171 <tr class="memitem:a61679f178111963a9ffa3c8179553f7a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="json__tokener_8h.html#a61679f178111963a9ffa3c8179553f7a">json_tokener_parse_ex</a> (struct <a class="el" href="structjson__tokener.html">json_tokener</a> *tok, const char *str, int len)</td></tr> 172 <tr class="separator:a61679f178111963a9ffa3c8179553f7a"><td class="memSeparator" colspan="2"> </td></tr> 173 </table> 174 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> 175 <div class="textblock"><p>Methods to parse an input string into a tree of json_object objects. </p> 176 </div><h2 class="groupheader">Macro Definition Documentation</h2> 177 <a class="anchor" id="aa74428c9cf57655eea5b49feae3f2704"></a> 178 <div class="memitem"> 179 <div class="memproto"> 180 <table class="memname"> 181 <tr> 182 <td class="memname">#define JSON_TOKENER_ALLOW_TRAILING_CHARS   0x02</td> 183 </tr> 184 </table> 185 </div><div class="memdoc"> 186 <p>Use with JSON_TOKENER_STRICT to allow trailing characters after the first parsed object.</p> 187 <dl class="section see"><dt>See Also</dt><dd><a class="el" href="json__tokener_8h.html#a7e7a0c0c9dc79e5e47b2608bb8aad7b7">json_tokener_set_flags()</a> </dd></dl> 188 189 </div> 190 </div> 191 <a class="anchor" id="a5ccd346459feb66e4e0af32005360279"></a> 192 <div class="memitem"> 193 <div class="memproto"> 194 <table class="memname"> 195 <tr> 196 <td class="memname">#define JSON_TOKENER_DEFAULT_DEPTH   32</td> 197 </tr> 198 </table> 199 </div><div class="memdoc"> 200 201 </div> 202 </div> 203 <a class="anchor" id="a72be595cb7e090c70b1d29feb1cbfb16"></a> 204 <div class="memitem"> 205 <div class="memproto"> 206 <table class="memname"> 207 <tr> 208 <td class="memname">#define JSON_TOKENER_STRICT   0x01</td> 209 </tr> 210 </table> 211 </div><div class="memdoc"> 212 <p>Be strict when parsing JSON input. Use caution with this flag as what is considered valid may become more restrictive from one release to the next, causing your code to fail on previously working input.</p> 213 <p>Note that setting this will also effectively disable parsing of multiple json objects in a single character stream (e.g. {"foo":123}{"bar":234}); if you want to allow that also set JSON_TOKENER_ALLOW_TRAILING_CHARS</p> 214 <p>This flag is not set by default.</p> 215 <dl class="section see"><dt>See Also</dt><dd><a class="el" href="json__tokener_8h.html#a7e7a0c0c9dc79e5e47b2608bb8aad7b7">json_tokener_set_flags()</a> </dd></dl> 216 217 </div> 218 </div> 219 <a class="anchor" id="a633ab043f2b07fd22420af2b369a260a"></a> 220 <div class="memitem"> 221 <div class="memproto"> 222 <table class="memname"> 223 <tr> 224 <td class="memname">#define JSON_TOKENER_VALIDATE_UTF8   0x10</td> 225 </tr> 226 </table> 227 </div><div class="memdoc"> 228 <p>Cause <a class="el" href="json__tokener_8h.html#a61679f178111963a9ffa3c8179553f7a">json_tokener_parse_ex()</a> to validate that input is UTF8. If this flag is specified and validation fails, then json_tokener_get_error(tok) will return json_tokener_error_parse_utf8_string</p> 229 <p>This flag is not set by default.</p> 230 <dl class="section see"><dt>See Also</dt><dd><a class="el" href="json__tokener_8h.html#a7e7a0c0c9dc79e5e47b2608bb8aad7b7">json_tokener_set_flags()</a> </dd></dl> 231 232 </div> 233 </div> 234 <h2 class="groupheader">Typedef Documentation</h2> 235 <a class="anchor" id="a4dd5e5b65aee7f376f529f86b210ff49"></a> 236 <div class="memitem"> 237 <div class="memproto"> 238 <table class="memname"> 239 <tr> 240 <td class="memname">typedef struct <a class="el" href="structjson__tokener.html">json_tokener</a> <a class="el" href="structjson__tokener.html">json_tokener</a></td> 241 </tr> 242 </table> 243 </div><div class="memdoc"> 244 <dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000004">Deprecated:</a></b></dt><dd>Unused in json-c code </dd></dl> 245 246 </div> 247 </div> 248 <h2 class="groupheader">Enumeration Type Documentation</h2> 249 <a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59"></a> 250 <div class="memitem"> 251 <div class="memproto"> 252 <table class="memname"> 253 <tr> 254 <td class="memname">enum <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59">json_tokener_error</a></td> 255 </tr> 256 </table> 257 </div><div class="memdoc"> 258 <dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0"> 259 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59afe2fa9bde03155019b2df30f66a5fcd0"></a>json_tokener_success</em> </td><td> 260 </td></tr> 261 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59a9b26e920ca765df91c84e999561d8fb0"></a>json_tokener_continue</em> </td><td> 262 </td></tr> 263 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59a59b2c36d9cc30c3038e09b9ddee6c86c"></a>json_tokener_error_depth</em> </td><td> 264 </td></tr> 265 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59a8f774f4c7869afdd9b92295fca3a9ded"></a>json_tokener_error_parse_eof</em> </td><td> 266 </td></tr> 267 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59a3309fa8ea4ab3ee0a81c55b69d223710"></a>json_tokener_error_parse_unexpected</em> </td><td> 268 </td></tr> 269 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59a641bbb8d881fdd1e463f20a1a203b77c"></a>json_tokener_error_parse_null</em> </td><td> 270 </td></tr> 271 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59addbdfe084e20709da3d20c8ae8ca278c"></a>json_tokener_error_parse_boolean</em> </td><td> 272 </td></tr> 273 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59ab1b3ad685eb97235d269cc5b9eb7ab81"></a>json_tokener_error_parse_number</em> </td><td> 274 </td></tr> 275 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59a574846740b785146f164a209dc89574e"></a>json_tokener_error_parse_array</em> </td><td> 276 </td></tr> 277 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59a2003bd8e96c6680cd22419c5ceafd4c0"></a>json_tokener_error_parse_object_key_name</em> </td><td> 278 </td></tr> 279 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59af91a2a819b0d6344d6d4e1d2579f28fd"></a>json_tokener_error_parse_object_key_sep</em> </td><td> 280 </td></tr> 281 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59a9ddb98741aebf7ac44735b4a43717013"></a>json_tokener_error_parse_object_value_sep</em> </td><td> 282 </td></tr> 283 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59a033ce89ce7b8f9e591e4bea92121c4c7"></a>json_tokener_error_parse_string</em> </td><td> 284 </td></tr> 285 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59a3588c05b1da8b909a8cbdef66b0a1a28"></a>json_tokener_error_parse_comment</em> </td><td> 286 </td></tr> 287 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59ab405d4a1282f3b037048d3456869a4c1"></a>json_tokener_error_parse_utf8_string</em> </td><td> 288 </td></tr> 289 <tr><td valign="top"><em><a class="anchor" id="a0a31f0df8a532ef8be5c09ba40eacb59a1eeed74de65c0c12c9f9c28cf4f3ff1d"></a>json_tokener_error_size</em> </td><td> 290 </td></tr> 291 </table> 292 </dd> 293 </dl> 294 295 </div> 296 </div> 297 <a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2"></a> 298 <div class="memitem"> 299 <div class="memproto"> 300 <table class="memname"> 301 <tr> 302 <td class="memname">enum <a class="el" href="json__tokener_8h.html#af026dec71e4548e6200eb2f902f1c4e2">json_tokener_state</a></td> 303 </tr> 304 </table> 305 </div><div class="memdoc"> 306 <dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000002">Deprecated:</a></b></dt><dd>Don't use this outside of json_tokener.c, it will be made private in a future release. </dd></dl> 307 <dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0"> 308 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a9db152607ec1872a000f1fcd8757297d"></a>json_tokener_state_eatws</em> </td><td> 309 </td></tr> 310 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a7c4c0bed1ebde45f5a99de4278792d72"></a>json_tokener_state_start</em> </td><td> 311 </td></tr> 312 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2ad80b689cb709967b67a348de3d8601d2"></a>json_tokener_state_finish</em> </td><td> 313 </td></tr> 314 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a668fb2654c59608945370003403a5792"></a>json_tokener_state_null</em> </td><td> 315 </td></tr> 316 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a0ff1d1935d49188aa1e6b998d43e655c"></a>json_tokener_state_comment_start</em> </td><td> 317 </td></tr> 318 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a8c2680b8873a8dce85f0b1ac25882dc9"></a>json_tokener_state_comment</em> </td><td> 319 </td></tr> 320 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2ad8151350b1ef50298bafbab244ac1162"></a>json_tokener_state_comment_eol</em> </td><td> 321 </td></tr> 322 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a62cef297a37a98b1239ea4bbd39723e1"></a>json_tokener_state_comment_end</em> </td><td> 323 </td></tr> 324 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2aa90ea4c327a285bfbbce49d42d491d65"></a>json_tokener_state_string</em> </td><td> 325 </td></tr> 326 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a1cf793d73587f68c4f2b3b4f65ff728e"></a>json_tokener_state_string_escape</em> </td><td> 327 </td></tr> 328 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a6c852da2e694be56799c58c201d6dca0"></a>json_tokener_state_escape_unicode</em> </td><td> 329 </td></tr> 330 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a482827c786d2378635ef54dc2b092264"></a>json_tokener_state_escape_unicode_need_escape</em> </td><td> 331 </td></tr> 332 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a5cab1cdfea9128e0ed9db85ffdc71df4"></a>json_tokener_state_escape_unicode_need_u</em> </td><td> 333 </td></tr> 334 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a3525b15ecd0a698281b3914115b6bd3e"></a>json_tokener_state_boolean</em> </td><td> 335 </td></tr> 336 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a7ce18d281d322af690b45f3b8b599e81"></a>json_tokener_state_number</em> </td><td> 337 </td></tr> 338 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2ab3d763300f1914865be09d603ddc11f4"></a>json_tokener_state_array</em> </td><td> 339 </td></tr> 340 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2aa2a01798ebe318ea91c38a886418f771"></a>json_tokener_state_array_add</em> </td><td> 341 </td></tr> 342 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a4ec7762aeab3424cbb14354c94025865"></a>json_tokener_state_array_sep</em> </td><td> 343 </td></tr> 344 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a8c7dbda177a5d83a36a64f7cb99b9a29"></a>json_tokener_state_object_field_start</em> </td><td> 345 </td></tr> 346 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a77375940a10806e81d99876d13be67fc"></a>json_tokener_state_object_field</em> </td><td> 347 </td></tr> 348 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a0220aea1d9204aadfffde92c7f73f5f7"></a>json_tokener_state_object_field_end</em> </td><td> 349 </td></tr> 350 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a4c7b7deac37355491572f6da84f208aa"></a>json_tokener_state_object_value</em> </td><td> 351 </td></tr> 352 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2ade6bee72f2147e634b19eb84e58eb162"></a>json_tokener_state_object_value_add</em> </td><td> 353 </td></tr> 354 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2adaf3e06c5fc04fd4f04040cd67698215"></a>json_tokener_state_object_sep</em> </td><td> 355 </td></tr> 356 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2ab1a0ad626ec662c1ba4fb5bfee1cd0a9"></a>json_tokener_state_array_after_sep</em> </td><td> 357 </td></tr> 358 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2a3a2c9cf26d076936a10a6ae3ca4eb523"></a>json_tokener_state_object_field_start_after_sep</em> </td><td> 359 </td></tr> 360 <tr><td valign="top"><em><a class="anchor" id="af026dec71e4548e6200eb2f902f1c4e2ab9f6244bfca4924db61ed3050c780b53"></a>json_tokener_state_inf</em> </td><td> 361 </td></tr> 362 </table> 363 </dd> 364 </dl> 365 366 </div> 367 </div> 368 <h2 class="groupheader">Function Documentation</h2> 369 <a class="anchor" id="af060dd6b593b3b710044bcb97dcec07f"></a> 370 <div class="memitem"> 371 <div class="memproto"> 372 <table class="memname"> 373 <tr> 374 <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> const char* json_tokener_error_desc </td> 375 <td>(</td> 376 <td class="paramtype">enum <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59">json_tokener_error</a> </td> 377 <td class="paramname"><em>jerr</em></td><td>)</td> 378 <td></td> 379 </tr> 380 </table> 381 </div><div class="memdoc"> 382 <p>Given an error previously returned by <a class="el" href="json__tokener_8h.html#af5d7ffd95a0f6e5d5bb5994d233b4197">json_tokener_get_error()</a>, return a human readable description of the error.</p> 383 <dl class="section return"><dt>Returns</dt><dd>a generic error message is returned if an invalid error value is provided. </dd></dl> 384 385 </div> 386 </div> 387 <a class="anchor" id="a887c4661906fc6b36cc366304e522534"></a> 388 <div class="memitem"> 389 <div class="memproto"> 390 <table class="memname"> 391 <tr> 392 <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> void json_tokener_free </td> 393 <td>(</td> 394 <td class="paramtype">struct <a class="el" href="structjson__tokener.html">json_tokener</a> * </td> 395 <td class="paramname"><em>tok</em></td><td>)</td> 396 <td></td> 397 </tr> 398 </table> 399 </div><div class="memdoc"> 400 <p>Free a <a class="el" href="structjson__tokener.html">json_tokener</a> previously allocated with <a class="el" href="json__tokener_8h.html#a5ac7e2c350bc592cf2fa7b9935b00ef5">json_tokener_new()</a>. </p> 401 402 </div> 403 </div> 404 <a class="anchor" id="af5d7ffd95a0f6e5d5bb5994d233b4197"></a> 405 <div class="memitem"> 406 <div class="memproto"> 407 <table class="memname"> 408 <tr> 409 <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> enum <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59">json_tokener_error</a> json_tokener_get_error </td> 410 <td>(</td> 411 <td class="paramtype">struct <a class="el" href="structjson__tokener.html">json_tokener</a> * </td> 412 <td class="paramname"><em>tok</em></td><td>)</td> 413 <td></td> 414 </tr> 415 </table> 416 </div><div class="memdoc"> 417 <p>Retrieve the error caused by the last call to <a class="el" href="json__tokener_8h.html#a61679f178111963a9ffa3c8179553f7a">json_tokener_parse_ex()</a>, or json_tokener_success if there is no error.</p> 418 <p>When parsing a JSON string in pieces, if the tokener is in the middle of parsing this will return json_tokener_continue.</p> 419 <dl class="section see"><dt>See Also</dt><dd><a class="el" href="json__tokener_8h.html#af060dd6b593b3b710044bcb97dcec07f">json_tokener_error_desc()</a>. </dd></dl> 420 421 </div> 422 </div> 423 <a class="anchor" id="a4a2fa28d815f8b370cbb00b80ebc0f1d"></a> 424 <div class="memitem"> 425 <div class="memproto"> 426 <table class="memname"> 427 <tr> 428 <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> size_t json_tokener_get_parse_end </td> 429 <td>(</td> 430 <td class="paramtype">struct <a class="el" href="structjson__tokener.html">json_tokener</a> * </td> 431 <td class="paramname"><em>tok</em></td><td>)</td> 432 <td></td> 433 </tr> 434 </table> 435 </div><div class="memdoc"> 436 <p>Return the offset of the byte after the last byte parsed relative to the start of the most recent string passed in to <a class="el" href="json__tokener_8h.html#a61679f178111963a9ffa3c8179553f7a">json_tokener_parse_ex()</a>. i.e. this is where parsing would start again if the input contains another JSON object after the currently parsed one.</p> 437 <p>Note that when multiple parse calls are issued, this is <em>not</em> the total number of characters parsed.</p> 438 <p>In the past this would have been accessed as tok->char_offset.</p> 439 <p>See <a class="el" href="json__tokener_8h.html#a61679f178111963a9ffa3c8179553f7a">json_tokener_parse_ex()</a> for an example of how to use this. </p> 440 441 </div> 442 </div> 443 <a class="anchor" id="a5ac7e2c350bc592cf2fa7b9935b00ef5"></a> 444 <div class="memitem"> 445 <div class="memproto"> 446 <table class="mlabels"> 447 <tr> 448 <td class="mlabels-left"> 449 <table class="memname"> 450 <tr> 451 <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> struct <a class="el" href="structjson__tokener.html">json_tokener</a>* json_tokener_new </td> 452 <td>(</td> 453 <td class="paramtype">void </td> 454 <td class="paramname"></td><td>)</td> 455 <td></td> 456 </tr> 457 </table> 458 </td> 459 <td class="mlabels-right"> 460 <span class="mlabels"><span class="mlabel">read</span></span> </td> 461 </tr> 462 </table> 463 </div><div class="memdoc"> 464 <p>Allocate a new <a class="el" href="structjson__tokener.html">json_tokener</a>. When done using that to parse objects, free it with <a class="el" href="json__tokener_8h.html#a887c4661906fc6b36cc366304e522534">json_tokener_free()</a>. See <a class="el" href="json__tokener_8h.html#a61679f178111963a9ffa3c8179553f7a">json_tokener_parse_ex()</a> for usage details. </p> 465 466 </div> 467 </div> 468 <a class="anchor" id="a6a1583ddd434e13515d6232de813462e"></a> 469 <div class="memitem"> 470 <div class="memproto"> 471 <table class="mlabels"> 472 <tr> 473 <td class="mlabels-left"> 474 <table class="memname"> 475 <tr> 476 <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> struct <a class="el" href="structjson__tokener.html">json_tokener</a>* json_tokener_new_ex </td> 477 <td>(</td> 478 <td class="paramtype">int </td> 479 <td class="paramname"><em>depth</em></td><td>)</td> 480 <td></td> 481 </tr> 482 </table> 483 </td> 484 <td class="mlabels-right"> 485 <span class="mlabels"><span class="mlabel">read</span></span> </td> 486 </tr> 487 </table> 488 </div><div class="memdoc"> 489 <p>Allocate a new <a class="el" href="structjson__tokener.html">json_tokener</a> with a custom max nesting depth. </p> 490 <dl class="section see"><dt>See Also</dt><dd><a class="el" href="json__tokener_8h.html#a5ccd346459feb66e4e0af32005360279">JSON_TOKENER_DEFAULT_DEPTH</a> </dd></dl> 491 492 </div> 493 </div> 494 <a class="anchor" id="a236ef64d079822a4411d13eae7190c4d"></a> 495 <div class="memitem"> 496 <div class="memproto"> 497 <table class="mlabels"> 498 <tr> 499 <td class="mlabels-left"> 500 <table class="memname"> 501 <tr> 502 <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a>* json_tokener_parse </td> 503 <td>(</td> 504 <td class="paramtype">const char * </td> 505 <td class="paramname"><em>str</em></td><td>)</td> 506 <td></td> 507 </tr> 508 </table> 509 </td> 510 <td class="mlabels-right"> 511 <span class="mlabels"><span class="mlabel">read</span></span> </td> 512 </tr> 513 </table> 514 </div><div class="memdoc"> 515 <p>Parse a json_object out of the string <code>str</code>.</p> 516 <p>If you need more control over how the parsing occurs, see <a class="el" href="json__tokener_8h.html#a61679f178111963a9ffa3c8179553f7a">json_tokener_parse_ex()</a>. </p> 517 518 </div> 519 </div> 520 <a class="anchor" id="a61679f178111963a9ffa3c8179553f7a"></a> 521 <div class="memitem"> 522 <div class="memproto"> 523 <table class="mlabels"> 524 <tr> 525 <td class="mlabels-left"> 526 <table class="memname"> 527 <tr> 528 <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a>* json_tokener_parse_ex </td> 529 <td>(</td> 530 <td class="paramtype">struct <a class="el" href="structjson__tokener.html">json_tokener</a> * </td> 531 <td class="paramname"><em>tok</em>, </td> 532 </tr> 533 <tr> 534 <td class="paramkey"></td> 535 <td></td> 536 <td class="paramtype">const char * </td> 537 <td class="paramname"><em>str</em>, </td> 538 </tr> 539 <tr> 540 <td class="paramkey"></td> 541 <td></td> 542 <td class="paramtype">int </td> 543 <td class="paramname"><em>len</em> </td> 544 </tr> 545 <tr> 546 <td></td> 547 <td>)</td> 548 <td></td><td></td> 549 </tr> 550 </table> 551 </td> 552 <td class="mlabels-right"> 553 <span class="mlabels"><span class="mlabel">read</span></span> </td> 554 </tr> 555 </table> 556 </div><div class="memdoc"> 557 <p>Parse a string and return a non-NULL json_object if a valid JSON value is found. The string does not need to be a JSON object or array; it can also be a string, number or boolean value.</p> 558 <p>A partial JSON string can be parsed. If the parsing is incomplete, NULL will be returned and <a class="el" href="json__tokener_8h.html#af5d7ffd95a0f6e5d5bb5994d233b4197">json_tokener_get_error()</a> will return json_tokener_continue. <a class="el" href="json__tokener_8h.html#a61679f178111963a9ffa3c8179553f7a">json_tokener_parse_ex()</a> can then be called with additional bytes in str to continue the parsing.</p> 559 <p>If <a class="el" href="json__tokener_8h.html#a61679f178111963a9ffa3c8179553f7a">json_tokener_parse_ex()</a> returns NULL and the error is anything other than json_tokener_continue, a fatal error has occurred and parsing must be halted. Then, the tok object must not be reused until <a class="el" href="json__tokener_8h.html#a238649a59737be5152d525aeaf4153ab">json_tokener_reset()</a> is called.</p> 560 <p>When a valid JSON value is parsed, a non-NULL json_object will be returned, with a reference count of one which belongs to the caller. Also, <a class="el" href="json__tokener_8h.html#af5d7ffd95a0f6e5d5bb5994d233b4197">json_tokener_get_error()</a> will return json_tokener_success. Be sure to check the type with <a class="el" href="json__object_8h.html#a8ab506a3d8f4ba5eb6a12ce0a6bbd37b">json_object_is_type()</a> or <a class="el" href="json__object_8h.html#af256a3a7910e271a2b9735e5044c3827">json_object_get_type()</a> before using the object.</p> 561 <p>Trailing characters after the parsed value do not automatically cause an error. It is up to the caller to decide whether to treat this as an error or to handle the additional characters, perhaps by parsing another json value starting from that point.</p> 562 <p>If the caller knows that they are at the end of their input, the length passed MUST include the final '\0' character, so values with no inherent end (i.e. numbers) can be properly parsed, rather than just returning json_tokener_continue.</p> 563 <p>Extra characters can be detected by comparing the value returned by <a class="el" href="json__tokener_8h.html#a4a2fa28d815f8b370cbb00b80ebc0f1d">json_tokener_get_parse_end()</a> against the length of the last len parameter passed in.</p> 564 <p>The tokener does <b>not</b> maintain an internal buffer so the caller is responsible for a subsequent call to json_tokener_parse_ex with an appropriate str parameter starting with the extra characters.</p> 565 <p>This interface is presently not 64-bit clean due to the int len argument so the function limits the maximum string size to INT32_MAX (2GB). If the function is called with len == -1 then strlen is called to check the string length is less than INT32_MAX (2GB)</p> 566 <p>Example: </p> 567 <div class="fragment"><div class="line"><a class="code" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914" title="The core type for all type of JSON objects handled by json-c.">json_object</a> *jobj = NULL;</div> 568 <div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span> *mystring = NULL;</div> 569 <div class="line"><span class="keywordtype">int</span> stringlen = 0;</div> 570 <div class="line"><span class="keyword">enum</span> <a class="code" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59">json_tokener_error</a> jerr;</div> 571 <div class="line"><span class="keywordflow">do</span> {</div> 572 <div class="line"> mystring = ... <span class="comment">// get JSON string, e.g. read from file, etc...</span></div> 573 <div class="line"> stringlen = strlen(mystring);</div> 574 <div class="line"> <span class="keywordflow">if</span> (end_of_input)</div> 575 <div class="line"> stringlen++; <span class="comment">// Include the '\0' if we know we're at the end of input</span></div> 576 <div class="line"> jobj = <a class="code" href="json__tokener_8h.html#a61679f178111963a9ffa3c8179553f7a">json_tokener_parse_ex</a>(tok, mystring, stringlen);</div> 577 <div class="line">} <span class="keywordflow">while</span> ((jerr = <a class="code" href="json__tokener_8h.html#af5d7ffd95a0f6e5d5bb5994d233b4197">json_tokener_get_error</a>(tok)) == <a class="code" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59a9b26e920ca765df91c84e999561d8fb0">json_tokener_continue</a>);</div> 578 <div class="line"><span class="keywordflow">if</span> (jerr != <a class="code" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59afe2fa9bde03155019b2df30f66a5fcd0">json_tokener_success</a>)</div> 579 <div class="line">{</div> 580 <div class="line"> fprintf(stderr, <span class="stringliteral">"Error: %s\n"</span>, <a class="code" href="json__tokener_8h.html#af060dd6b593b3b710044bcb97dcec07f">json_tokener_error_desc</a>(jerr));</div> 581 <div class="line"> <span class="comment">// Handle errors, as appropriate for your application.</span></div> 582 <div class="line">}</div> 583 <div class="line"><span class="keywordflow">if</span> (<a class="code" href="json__tokener_8h.html#a4a2fa28d815f8b370cbb00b80ebc0f1d">json_tokener_get_parse_end</a>(tok) < stringlen)</div> 584 <div class="line">{</div> 585 <div class="line"> <span class="comment">// Handle extra characters after parsed object as desired.</span></div> 586 <div class="line"> <span class="comment">// e.g. issue an error, parse another object from that point, etc...</span></div> 587 <div class="line">}</div> 588 <div class="line"><span class="comment">// Success, use jobj here.</span></div> 589 </div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd> 590 <table class="params"> 591 <tr><td class="paramname">tok</td><td>a <a class="el" href="structjson__tokener.html">json_tokener</a> previously allocated with <a class="el" href="json__tokener_8h.html#a5ac7e2c350bc592cf2fa7b9935b00ef5">json_tokener_new()</a> </td></tr> 592 <tr><td class="paramname">str</td><td>an string with any valid JSON expression, or portion of. This does not need to be null terminated. </td></tr> 593 <tr><td class="paramname">len</td><td>the length of str </td></tr> 594 </table> 595 </dd> 596 </dl> 597 598 </div> 599 </div> 600 <a class="anchor" id="a735f2dc755d57ed5c5b807aaaaef3b14"></a> 601 <div class="memitem"> 602 <div class="memproto"> 603 <table class="mlabels"> 604 <tr> 605 <td class="mlabels-left"> 606 <table class="memname"> 607 <tr> 608 <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> struct <a class="el" href="json__types_8h.html#af27907ced0f5a43409ad96430fe0f914">json_object</a>* json_tokener_parse_verbose </td> 609 <td>(</td> 610 <td class="paramtype">const char * </td> 611 <td class="paramname"><em>str</em>, </td> 612 </tr> 613 <tr> 614 <td class="paramkey"></td> 615 <td></td> 616 <td class="paramtype">enum <a class="el" href="json__tokener_8h.html#a0a31f0df8a532ef8be5c09ba40eacb59">json_tokener_error</a> * </td> 617 <td class="paramname"><em>error</em> </td> 618 </tr> 619 <tr> 620 <td></td> 621 <td>)</td> 622 <td></td><td></td> 623 </tr> 624 </table> 625 </td> 626 <td class="mlabels-right"> 627 <span class="mlabels"><span class="mlabel">read</span></span> </td> 628 </tr> 629 </table> 630 </div><div class="memdoc"> 631 <p>Parser a json_object out of the string <code>str</code>, but if it fails return the error in <code>*error</code>. </p> 632 <dl class="section see"><dt>See Also</dt><dd><a class="el" href="json__tokener_8h.html#a236ef64d079822a4411d13eae7190c4d">json_tokener_parse()</a> </dd> 633 <dd> 634 <a class="el" href="json__tokener_8h.html#a61679f178111963a9ffa3c8179553f7a">json_tokener_parse_ex()</a> </dd></dl> 635 636 </div> 637 </div> 638 <a class="anchor" id="a238649a59737be5152d525aeaf4153ab"></a> 639 <div class="memitem"> 640 <div class="memproto"> 641 <table class="memname"> 642 <tr> 643 <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> void json_tokener_reset </td> 644 <td>(</td> 645 <td class="paramtype">struct <a class="el" href="structjson__tokener.html">json_tokener</a> * </td> 646 <td class="paramname"><em>tok</em></td><td>)</td> 647 <td></td> 648 </tr> 649 </table> 650 </div><div class="memdoc"> 651 <p>Reset the state of a <a class="el" href="structjson__tokener.html">json_tokener</a>, to prepare to parse a brand new JSON object. </p> 652 653 </div> 654 </div> 655 <a class="anchor" id="a7e7a0c0c9dc79e5e47b2608bb8aad7b7"></a> 656 <div class="memitem"> 657 <div class="memproto"> 658 <table class="memname"> 659 <tr> 660 <td class="memname"><a class="el" href="printbuf_8h.html#a2a31d5c00f3a4712f2d5d62aee66344e">JSON_EXPORT</a> void json_tokener_set_flags </td> 661 <td>(</td> 662 <td class="paramtype">struct <a class="el" href="structjson__tokener.html">json_tokener</a> * </td> 663 <td class="paramname"><em>tok</em>, </td> 664 </tr> 665 <tr> 666 <td class="paramkey"></td> 667 <td></td> 668 <td class="paramtype">int </td> 669 <td class="paramname"><em>flags</em> </td> 670 </tr> 671 <tr> 672 <td></td> 673 <td>)</td> 674 <td></td><td></td> 675 </tr> 676 </table> 677 </div><div class="memdoc"> 678 <p>Set flags that control how parsing will be done. </p> 679 680 </div> 681 </div> 682 </div><!-- contents --> 683 <!-- start footer part --> 684 <hr class="footer"/><address class="footer"><small> 685 Generated on Sun Jul 26 2020 15:11:19 for json-c by  <a href="http://www.doxygen.org/index.html"> 686 <img class="footer" src="doxygen.png" alt="doxygen"/> 687 </a> 1.8.2 688 </small></address> 689 </body> 690 </html>
This page was automatically generated by LXR 0.3.1. • OpenWrt