mirror of
https://github.com/nlohmann/json.git
synced 2026-11-15 20:08:03 +00:00
📝 add examples for parsing from iterator pair (#3100)
This commit is contained in:
1 parent
f5b3fb326c
commit
c4a4e672fd
7 files changed
+77
-2
No files matched your search
@@ -0,0 +1,15 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
int main()
|
||||
{
|
||||
// a JSON text given as string that is not null-terminated
|
||||
const char* ptr = "[1,2,3]another value";
|
||||
|
||||
// parse and serialize JSON
|
||||
json j_complete = json::parse(ptr, ptr + 7);
|
||||
std::cout << std::setw(4) << j_complete << "\n\n";
|
||||
}
|
||||
Reference in new issue
Block a user