Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 518 Bytes

README.md

File metadata and controls

23 lines (20 loc) · 518 Bytes

cpp-jsonlib

A C++17 single-file header-only library for RapidJSON SAX interface

#include <iostream>
#include "jsonlib.h"

int main(void) {
  std::string json;
  while (std::getline(std::cin, json)) {
    std::string key;
    jsonlib::parse(json, {
      .Key = [&](auto str, auto len) {
        key.assign(str, len);
      },
      .String = [&](auto str, auto len) {
        std::cout << key << ": " << std::string(str, len) << std::endl;
      }
    });
  }
}