json2cpp is compiles a json file into static constexpr data structures that can be used at compile time or runtime

Overview

json2cpp

CI codecov Language grade: C++

json2cpp is compiles a json file into static constexpr data structures that can be used at compile time or runtime.

Features

  • Literally 0 runtime overhead for loading the statically compiled JSON resource
  • Fully constexpr capable if you want to make compile-time decisions based on the JSON resource file
  • A .cpp firewall file is provided for you, if you have a large resource and don't want to pay the cost of compiling it more than once (but for normal size files it is VERY fast to compile, they are just data structures)
  • nlohmann::json compatible API (should be a drop-in replacement, some features might still be missing)
  • valijson adapter file provided

See tests folder for examples for building resources, using the valijson adapter, constexpr usage of resources, and firewalled usage of resources.

You might also like...
JSON encoder/decoder in a single C file.

xJSON xJSON is a lightweight library that implements a JSON encoder, decoder and other utility functions. Usage To use xJSON, just add xjson.c and xjs

C library for encoding, decoding and manipulating JSON data

Jansson README Jansson is a C library for encoding, decoding and manipulating JSON data. Its main features and design principles are: Simple and intui

QJson is a qt-based library that maps JSON data to QVariant objects.

QJson JSON (JavaScript Object Notation) is a lightweight data-interchange format. It can represents integer, real number, string, an ordered sequence

A Simple Nastran to JSON mesh reader which makes it easy to exchange data
A Simple Nastran to JSON mesh reader which makes it easy to exchange data

Nastran to Json Converter A simple code that helps convert Nastran meshes to a JSON file format that is more suitable for the current day and age. Cur

A small header-only library for converting data between json representation and c++ structs

Table of Contents Table of Contents What Is json_dto? What's new? v.0.3.0 v.0.2.14 v.0.2.13 v.0.2.12 v.0.2.11 v.0.2.10 v.0.2.9 v.0.2.8 v.0.2.7 v.0.2.6

Ultralightweight JSON parser in ANSI C

cJSON Ultralightweight JSON parser in ANSI C. Table of contents License Usage Welcome to cJSON Building Copying the source CMake Makefile Vcpkg Includ

JSON parser and generator for C/C++ with scanf/printf like interface. Targeting embedded systems.

JSON parser and emitter for C/C++ Features ISO C and ISO C++ compliant portable code Very small footprint No dependencies json_scanf() scans a string

JSON & BSON parser/writer

jbson is a library for building & iterating BSON data, and JSON documents in C++14. \tableofcontents Features # {#features} Header only. Boost license

A very sane (header only) C++14 JSON library

JeayeSON - a very sane C++14 JSON library JeayeSON was designed out of frustration that there aren't many template-based approaches to handling JSON i

Comments
  • [info] cppcheck 2.7 makes a debug build fail

    [info] cppcheck 2.7 makes a debug build fail

    This is only for std::string_view. I built cppcheck today from main, at https://github.com/danmar/cppcheck/commit/24e98591586aa689d3a4d6095f70da3358bc1989

    /home/julien/Software/Others/json2cpp/src/json2cpp.hpp:20:48: performance: Function parameter 'document_name' should be passed by const reference. [passedByValue]
    compile_results compile(const std::string_view document_name, const nlohmann::json &json);
                                                   ^
    

    I realize this is idiomatic, but I thought you may be interested in knowing that currently it will fail, as it is enabled by default (provided you have cppcheck installed already on your system)

    Note: I opened a PR to cppcheck to allow passing std::string_view by value: https://github.com/danmar/cppcheck/pull/3817

    opened by jmarrec 10
  • Why not a constexpr json parser?

    Why not a constexpr json parser?

    Is it because it's harder to implement a constexpr friendly json parser and you didn't have time for creating one that you end up doing this project, @lefticus ?

    Because I was thinking about making similar thing to this but I thought a constexpr version is much better if there was any!

    opened by the-moisrex 4
Releases(snapshot-9145ad94d0b725eaa4599a9a7770e0ecc79d2cf6)
Owner
Jason Turner
Host of C++ Weekly YouTube series, co-host of CppCast C++ podcast.
Jason Turner
https://github.com/json-c/json-c is the official code repository for json-c. See the wiki for release tarballs for download. API docs at http://json-c.github.io/json-c/

\mainpage json-c Overview and Build Status Building on Unix Prerequisites Build commands CMake options Testing Building with vcpkg Linking to libjson-

json-c 2.5k Sep 13, 2022
This is a JSON C++ library. It can write and read JSON files with ease and speed.

Json Box JSON (JavaScript Object Notation) is a lightweight data-interchange format. Json Box is a C++ library used to read and write JSON with ease a

Anhero inc. 108 Aug 26, 2022
A simple class for parsing JSON data into a QVariant hierarchy and vice versa.

The qt-json project is a simple collection of functions for parsing and serializing JSON data to and from QVariant hierarchies. NOTE: Qt5 introduced a

null 302 Sep 15, 2022
A simple class for parsing JSON data into a QVariant hierarchy and vice versa.

The qt-json project is a simple collection of functions for parsing and serializing JSON data to and from QVariant hierarchies. NOTE: Qt5 introduced a

null 302 Sep 15, 2022
json-cpp is a C++11 JSON serialization library.

JSON parser and generator for C++ Version 0.1 alpha json-cpp is a C++11 JSON serialization library. Example #include <json-cpp.hpp> struct Foo {

Anatoly Scheglov 4 Dec 31, 2019
A convenience C++ wrapper library for JSON-Glib providing friendly syntactic sugar for parsing JSON

This library is a wrapper for the json-glib library that aims to provide the user with a trivial alternative API to the API provided by the base json-

Rob J Meijer 16 May 10, 2022
json-build is a zero-allocation JSON serializer compatible with C89

json-build is a zero-allocation JSON serializer compatible with C89. It is inspired by jsmn, a minimalistic JSON tokenizer.

Lucas Müller 28 Sep 14, 2022
Convert YouTube Subscriptions JSON into RSS Reader Compatible OPML

OPMLify Convert YouTube Subscriptions JSON into RSS Reader Compatible OPML Brief Overview OPMLify allows you to import your YouTube Subscriptions to a

null 13 May 25, 2022
a header-file-only, JSON parser serializer in C++

PicoJSON - a C++ JSON parser / serializer Copyright © 2009-2010 Cybozu Labs, Inc. Copyright © 2011-2015 Kazuho Oku Licensed under 2-clause BSD license

Kazuho Oku 1k Sep 19, 2022
This is a demo for QDBus & parse json file.

说明 This is a demo for QDBus & parse json file. cmake version:3.13.4 qtcreator 4.8.2验证ok cli侧的 --version暂时没有使用 使用方式 mkdir build cd build cmake .. 开Debu

流浪小兵 1 Nov 26, 2021