[#nlohmann-basic_json-0c-accept-07] = xref:nlohmann.adoc[nlohmann]::xref:nlohmann/basic_json-0c.adoc[basic_json]::accept :relfileprefix: ../../ :mrdocs: check if the input is valid JSON == Synopsis Declared in `<nlohmann/json.hpp>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- [[nodiscard, deprecated]] static bool accept( /* implementation-defined */::span_input_adapter&& i, 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 accept(ptr, ptr + len). Use of this entity is allowed but discouraged. ==== == Return Value whether the input is valid JSON [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 check | *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]#