📝 add documentation and example for accept function

This commit is contained in:
Niels Lohmann 2020-06-07 20:59:43 +02:00
parent 543dcee3a7
commit 8c1d26e186
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
5 changed files with 84 additions and 2 deletions

View file

@ -0,0 +1,26 @@
#include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// a valid JSON text
auto valid_text = R"(
{
"numbers": [1, 2, 3]
}
)";
// an invalid JSON text
auto invalid_text = R"(
{
"strings": ["extra", "comma", ]
}
)";
std::cout << std::boolalpha
<< json::accept(valid_text) << ' '
<< json::accept(invalid_text) << '\n';
}

View file

@ -0,0 +1 @@
<a target="_blank" href="https://wandbox.org/permlink/r5Tai1spihWHTdFA"><b>online</b></a>

View file

@ -0,0 +1 @@
true false