<areahref="classnlohmann_1_1detail_1_1exception.html"title="general exception of the basic_json class"alt="nlohmann::detail::exception"shape="rect"coords="0,0,176,24"/>
<trclass="memdesc:a9505aaa1ca943be927eec7cc579592ff"><tdclass="mdescLeft"> </td><tdclass="mdescRight">byte index of the parse error <ahref="classnlohmann_1_1detail_1_1parse__error.html#a9505aaa1ca943be927eec7cc579592ff">More...</a><br/></td></tr>
<trclass="memdesc:a0d4589a3fb54e81646d986c05efa3b9a inherit pub_attribs_classnlohmann_1_1detail_1_1exception"><tdclass="mdescLeft"> </td><tdclass="mdescRight">the id of the exception <br/></td></tr>
<trclass="inherit_header pub_methods_classnlohmann_1_1detail_1_1exception"><tdcolspan="2"onclick="javascript:toggleInherit('pub_methods_classnlohmann_1_1detail_1_1exception')"><imgsrc="closed.png"alt="-"/> Public Member Functions inherited from <aclass="el"href="classnlohmann_1_1detail_1_1exception.html">nlohmann::detail::exception</a></td></tr>
<divclass="textblock"><p>exception indicating a parse error </p>
<p>This exception is thrown by the library when a parse error occurs. Parse errors can occur during the deserialization of JSON text, CBOR, MessagePack, as well as when using JSON Patch.</p>
<p>Member <em>byte</em> holds the byte index of the last read character in the input file.</p>
<p>Exceptions have ids 1xx.</p>
<tableclass="markdownTable">
<trclass="markdownTableHead">
<thclass="markdownTableHeadNone">name / id </th><thclass="markdownTableHeadNone">example message </th><thclass="markdownTableHeadNone">description </th></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.parse_error.101 </td><tdclass="markdownTableBodyNone">parse error at 2: unexpected end of input; expected string literal </td><tdclass="markdownTableBodyNone">This error indicates a syntax error while deserializing a JSON text. The error message describes that an unexpected token (character) was encountered, and the member <em>byte</em> indicates the error position. </td></tr>
<trclass="markdownTableRowEven">
<tdclass="markdownTableBodyNone">json.exception.parse_error.102 </td><tdclass="markdownTableBodyNone">parse error at 14: missing or wrong low surrogate </td><tdclass="markdownTableBodyNone">JSON uses the <code>\uxxxx</code> format to describe Unicode characters. Code points above above 0xFFFF are split into two <code>\uxxxx</code> entries ("surrogate pairs"). This error indicates that the surrogate pair is incomplete or contains an invalid code point. </td></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.parse_error.103 </td><tdclass="markdownTableBodyNone">parse error: code points above 0x10FFFF are invalid </td><tdclass="markdownTableBodyNone">Unicode supports code points up to 0x10FFFF. Code points above 0x10FFFF are invalid. </td></tr>
<trclass="markdownTableRowEven">
<tdclass="markdownTableBodyNone">json.exception.parse_error.104 </td><tdclass="markdownTableBodyNone">parse error: JSON patch must be an array of objects </td><tdclass="markdownTableBodyNone"><ahref="https://tools.ietf.org/html/rfc6902">RFC 6902</a> requires a JSON Patch document to be a JSON document that represents an array of objects. </td></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.parse_error.105 </td><tdclass="markdownTableBodyNone">parse error: operation must have string member 'op' </td><tdclass="markdownTableBodyNone">An operation of a JSON Patch document must contain exactly one "op" member, whose value indicates the operation to perform. Its value must be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors. </td></tr>
<trclass="markdownTableRowEven">
<tdclass="markdownTableBodyNone">json.exception.parse_error.106 </td><tdclass="markdownTableBodyNone">parse error: array index '01' must not begin with '0' </td><tdclass="markdownTableBodyNone">An array index in a JSON Pointer (<ahref="https://tools.ietf.org/html/rfc6901">RFC 6901</a>) may be <code>0</code> or any number without a leading <code>0</code>. </td></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.parse_error.107 </td><tdclass="markdownTableBodyNone">parse error: JSON pointer must be empty or begin with '/' - was: 'foo' </td><tdclass="markdownTableBodyNone">A JSON Pointer must be a Unicode string containing a sequence of zero or more reference tokens, each prefixed by a <code>/</code> character. </td></tr>
<trclass="markdownTableRowEven">
<tdclass="markdownTableBodyNone">json.exception.parse_error.108 </td><tdclass="markdownTableBodyNone">parse error: escape character '~' must be followed with '0' or '1' </td><tdclass="markdownTableBodyNone">In a JSON Pointer, only <code>~0</code> and <code>~1</code> are valid escape sequences. </td></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.parse_error.109 </td><tdclass="markdownTableBodyNone">parse error: array index 'one' is not a number </td><tdclass="markdownTableBodyNone">A JSON Pointer array index must be a number. </td></tr>
<trclass="markdownTableRowEven">
<tdclass="markdownTableBodyNone">json.exception.parse_error.110 </td><tdclass="markdownTableBodyNone">parse error at 1: cannot read 2 bytes from vector </td><tdclass="markdownTableBodyNone">When parsing CBOR or MessagePack, the byte vector ends before the complete value has been read. </td></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.parse_error.112 </td><tdclass="markdownTableBodyNone">parse error at 1: error reading CBOR; last byte: 0xF8 </td><tdclass="markdownTableBodyNone">Not all types of CBOR or MessagePack are supported. This exception occurs if an unsupported byte was read. </td></tr>
<trclass="markdownTableRowEven">
<tdclass="markdownTableBodyNone">json.exception.parse_error.113 </td><tdclass="markdownTableBodyNone">parse error at 2: expected a CBOR string; last byte: 0x98 </td><tdclass="markdownTableBodyNone">While parsing a map key, a value that is not a string has been read. </td></tr>
<trclass="markdownTableRowOdd">
<tdclass="markdownTableBodyNone">json.exception.parse_error.114 </td><tdclass="markdownTableBodyNone">parse error: Unsupported BSON record type 0x0F </td><tdclass="markdownTableBodyNone">The parsing of the corresponding BSON record type is not implemented (yet). </td></tr>
<trclass="markdownTableRowEven">
<tdclass="markdownTableBodyNone">json.exception.parse_error.115 </td><tdclass="markdownTableBodyNone">parse error at byte 5: syntax error while parsing UBJSON high-precision number: invalid number text: 1A </td><tdclass="markdownTableBodyNone">A UBJSON high-precision number could not be parsed. </td></tr>
</table>
<dlclass="section note"><dt>Note</dt><dd>For an input with n bytes, 1 is the index of the first character and n+1 is the index of the terminating null byte or the end of file. This also holds true when reading a byte vector (CBOR or MessagePack).</dd></dl>
<p>@liveexample{The following code shows how a <code><aclass="el"href="classnlohmann_1_1detail_1_1parse__error.html"title="exception indicating a parse error">parse_error</a></code> exception can be caught.,<aclass="el"href="classnlohmann_1_1detail_1_1parse__error.html"title="exception indicating a parse error">parse_error</a>}</p>
<dlclass="section see"><dt>See also</dt><dd>- <aclass="el"href="classnlohmann_1_1detail_1_1exception.html">exception</a> for the base class of the library exceptions </dd>
<dd>
- <aclass="el"href="classnlohmann_1_1detail_1_1invalid__iterator.html">invalid_iterator</a> for exceptions indicating errors with iterators </dd>
<dd>
- <aclass="el"href="classnlohmann_1_1detail_1_1type__error.html">type_error</a> for exceptions indicating executing a member function with a wrong type </dd>
<dd>
- <aclass="el"href="classnlohmann_1_1detail_1_1out__of__range.html">out_of_range</a> for exceptions indicating access out of the defined range </dd>
<dd>
- <aclass="el"href="classnlohmann_1_1detail_1_1other__error.html">other_error</a> for exceptions indicating other library errors</dd></dl>
<tr><tdclass="paramdir">[in]</td><tdclass="paramname">id_</td><td>the id of the exception </td></tr>
<tr><tdclass="paramdir">[in]</td><tdclass="paramname">pos</td><td>the position where the error occurred (or with chars_read_total=0 if the position cannot be determined) </td></tr>
<p>The byte index of the last read character in the input file.</p>
<dlclass="section note"><dt>Note</dt><dd>For an input with n bytes, 1 is the index of the first character and n+1 is the index of the terminating null byte or the end of file. This also holds true when reading a byte vector (CBOR or MessagePack). </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<divid="nav-path"class="navpath"><!-- id is needed for treeview function! -->