deserialize from a pair of character iterators (or an iterator+sentinel pair, C++20 ranges support)
Declared in <nlohmann/json.hpp>
template<
typename IteratorType,
typename SentinelType = IteratorType>
requires detail::can_compare_ne<IteratorType, SentinelType>::value
[[nodiscard]]
static
basic_json
parse(
IteratorType first,
SentinelType last,
parser_callback_t cb = nullptr,
bool const allow_exceptions = true,
bool const ignore_comments = false,
bool const ignore_trailing_commas = false);
deserialized JSON value, or a discarded value if allow_exceptions is false and a parse error occurred
The return value should not be discarded.
| Name | Description |
|---|---|
| first | iterator to the start of the input |
| last | iterator to the end of the input, or a sentinel value comparable to first |
| cb | a parser callback function of type parser_callback_t which is used to control the deserialization by filtering the parsed values |
| allow_exceptions | whether to throw exceptions in case of a parse error |
| ignore_comments | whether comments should be ignored and treated like whitespace (true) or yield a parse error (false) |
| ignore_trailing_commas | whether trailing commas in arrays and objects should be ignored (true) or yield a parse error (false) |