1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-22 15:21:52 +03:00

📝 add examples for parsing from iterator pair (#3100)

This commit is contained in:
Niels Lohmann
2021-10-29 21:26:41 +02:00
committed by GitHub
parent f5b3fb326c
commit c4a4e672fd
7 changed files with 77 additions and 2 deletions

View File

@ -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";
}