MCPcopy Create free account
hub / github.com/boostorg/json / parse_options

Class parse_options

include/boost/json/parse_options.hpp:64–163  ·  view source on GitHub ↗

Parser options. This structure is used for specifying maximum parsing depth, and whether to allow various non-standard extensions. Default-constructed options set maximum parsing depth to 32 and specify that only standard JSON is allowed, @see @ref parse, @ref parser, @ref basic_parser. */

Source from the content-addressed store, hash-verified

62 @see @ref parse, @ref parser, @ref basic_parser.
63*/
64struct parse_options
65{
66 /** Maximum nesting level of arrays and objects.
67
68 This specifies the maximum number of nested structures allowed while
69 parsing a JSON text. If this limit is exceeded during a parse, an error
70 is returned.
71
72 @see @ref basic_parser, @ref stream_parser.
73 */
74 std::size_t max_depth = 32;
75
76 /** Number pasing mode.
77
78 This selects the way to parse numbers. The default is to parse them
79 fast, but with possible slight imprecision for floating point numbers
80 with larger mantissas. Users can also choose to parse numbers slower
81 but with full precision. Or to not parse them at all, and only validate
82 numbers. The latter mode is useful for @ref basic_parser instantiations
83 that wish to treat numbers in a custom way.
84
85 @see @ref basic_parser, @ref stream_parser.
86 */
87 number_precision numbers = number_precision::imprecise;
88
89 /** Non-standard extension option.
90
91 Allow C and C++ style comments to appear anywhere that whitespace is
92 permissible.
93
94 @see @ref basic_parser, @ref stream_parser.
95 */
96 bool allow_comments = false;
97
98 /** Non-standard extension option
99
100 Allow a trailing comma to appear after the last element of any array or
101 object.
102
103 @see @ref basic_parser, @ref stream_parser.
104 */
105 bool allow_trailing_commas = false;
106
107 /** Non-standard extension option
108
109 Allow invalid UTF-8 sequences to appear in keys and strings.
110
111 @note This increases parsing performance.
112
113 @see @ref basic_parser, @ref stream_parser.
114 */
115 bool allow_invalid_utf8 = false;
116
117 /** Non-standard extension option
118
119 Allow invalid UTF-16 surrogate pairs to appear in strings. When
120 enabled, the parser will not strictly validate the correctness of
121 UTF-16 encoding, allowing for the presence of illegal leading or

Callers 15

null_parserMethod · 0.85
do_rpcFunction · 0.85
null_parserMethod · 0.85
fail_parserMethod · 0.85
throw_parserMethod · 0.85
from_string_testMethod · 0.85
check_round_tripMethod · 0.85
grind_oneMethod · 0.85
grindMethod · 0.85
utf8_parserMethod · 0.85
std_null_parserMethod · 0.85
testCtorsMethod · 0.85

Calls

no outgoing calls

Tested by 3

null_parserMethod · 0.68
fail_parserMethod · 0.68
throw_parserMethod · 0.68