[#nlohmann-basic_json-0c-parse-08] = xref:nlohmann.adoc[nlohmann]::xref:nlohmann/basic_json-0c.adoc[basic_json]::parse :relfileprefix: ../../ :mrdocs: deserialize from a compatible input == Synopsis Declared in `<nlohmann/json.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard, deprecated]] static xref:nlohmann/basic_json-0c.adoc[basic_json] parse( /* implementation-defined */::span_input_adapter&& i, xref:nlohmann/basic_json-0c/parser_callback_t.adoc[parser_callback_t] cb = nullptr, bool const allow_exceptions = true, bool const ignore_comments = false, bool const ignore_trailing_commas = false); ---- [WARNING] ==== https://en.cppreference.com/cpp/language/attributes/deprecated[Deprecated^]: Since 3.8.0; use parse(ptr, ptr + len). Use of this entity is allowed but discouraged. ==== == Return Value deserialized JSON value, or a discarded value if `allow_exceptions` is `false` and a parse error occurred [NOTE] ==== The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^]. ==== == Parameters [cols="1,4"] |=== | Name| Description | *i* | input to read the JSON value from | *cb* | a parser callback function of type xref:nlohmann/basic_json-0c/parser_callback_t.adoc[`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`) |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#