Git Product home page Git Product logo

jconf's Introduction

JConf

Build Status

JConf library provides a way to manage Property Tree that has a schema to validate against. The property can be serialized and deserialized to JSON and some of its binary derivatives, such as BSON, CBOR, MessagePack, and UBJSON.

It is very similar in concept and usage to Boost's PropertyTree, but the main difference is that JConf has JSON Schema support for data validation.

Usage

jconf::Config config("config.json", "schema.json");
config.load();

// Retrieve a key
std::cout << config.get("some_key");
// Even works with nested properties(converted to a JSON pointer)
std::cout << config.get("/parent/child");

// Set an integer using nlohmann's json object
config.set({{"some_integer", 1337}});
config.set({{"some_integer", "string"}}); // Will raise an exception

// Set nested properties
// NOTE: Refer to the documentation of the `JSON framework` in `See also`
// for syntax documentation
config.set(R"({
                "multiple_values": {
                  "some_integer": 100,
                  "some_boolean": true
                }
              })"_json);

// Set parameters using a path
config.set("logging/level", "info");
config.set("queue/tx", 5000);

See also

JSON framework: https://github.com/nlohmann/json

Validation framework: https://github.com/pboettch/json-schema-validator/

JSON Schema reference: https://json-schema.org/understanding-json-schema/index.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.