📝 add documentation and example for accept function
This commit is contained in:
parent
543dcee3a7
commit
8c1d26e186
5 changed files with 84 additions and 2 deletions
26
doc/examples/accept__string.cpp
Normal file
26
doc/examples/accept__string.cpp
Normal 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';
|
||||
}
|
1
doc/examples/accept__string.link
Normal file
1
doc/examples/accept__string.link
Normal file
|
@ -0,0 +1 @@
|
|||
<a target="_blank" href="https://wandbox.org/permlink/r5Tai1spihWHTdFA"><b>online</b></a>
|
1
doc/examples/accept__string.output
Normal file
1
doc/examples/accept__string.output
Normal file
|
@ -0,0 +1 @@
|
|||
true false
|
Loading…
Add table
Add a link
Reference in a new issue