Skip to content

A swiss-army knife for expressive JSON programming in modern C++. Covers JSON, JSON Pointer, JSONL, and JSON Schema

License

Notifications You must be signed in to change notification settings

sourcemeta/jsontoolkit

Repository files navigation

JSON Toolkit

JSON Toolkit is a swiss-army knife for JSON programming in modern C++. It comes with a built-in parser and growing support for standards such as JSON Schema, JSON Pointer, JSONL, and more. For example:

#include <sourcemeta/jsontoolkit/json.h>
#include <sourcemeta/jsontoolkit/jsonpointer.h>

#include <sstream>
#include <iostream>
#include <stdlib>
#include <utility>

auto main() -> int {
  // Parsing a JSON document from a string
  auto document{sourcemeta::jsontoolkit::parse(R"JSON({
    "name": "John Doe",
    "age": 20,
    "address": "14 Manchester Road, Coventry CV77 1XN"
  })JSON")};

  // Updating a property using JSON Pointer
  const sourcemeta::jsontoolkit::Pointer pointer{"name"};
  sourcemeta::jsontoolkit::JSON new_value{"Jane Doe"};
  sourcemeta::jsontoolkit::set(document, pointer, std::move(new_value));

  // Pretty-print result
  sourcemeta::jsontoolkit::prettify(document, std::cout);
  std::cout << "\n";

  return EXIT_SUCCESS;
}

Documentation

Refer to the project website for documentation: https://jsontoolkit.sourcemeta.com.

About

A swiss-army knife for expressive JSON programming in modern C++. Covers JSON, JSON Pointer, JSONL, and JSON Schema

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

 

Languages