[#nlohmann-basic_json-0c-accept-02]
= xref:nlohmann.adoc[nlohmann]::xref:nlohmann/basic_json-0c.adoc[basic&lowbar;json]::accept
:relfileprefix: ../../
:mrdocs:

check if the input is valid JSON (iterator pair, or iterator&plus;sentinel pair for C&plus;&plus;20 ranges support)

== Synopsis

Declared in `&lt;nlohmann&sol;json&period;hpp&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    typename IteratorType,
    typename SentinelType = IteratorType&gt;
requires detail&colon;&colon;can&lowbar;compare&lowbar;ne&lt;IteratorType, SentinelType&gt;&colon;&colon;value
static
bool
accept(
    IteratorType first,
    SentinelType last,
    bool const ignore&lowbar;comments = false,
    bool const ignore&lowbar;trailing&lowbar;commas = false);
----

== Return Value

whether the input is valid JSON

== Parameters

[cols="1,4"]
|===
| 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_
| *ignore&lowbar;comments*
| whether comments should be ignored and treated like whitespace (`true`) or yield a parse error (`false`)
| *ignore&lowbar;trailing&lowbar;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]#
