A C++ JSON library
Find a file
2025-06-24 17:00:53 +02:00
include/rei-json Add Exceptions indicating which line contains error when parsing JSON 2024-11-29 10:50:49 +01:00
src Add Exceptions indicating which line contains error when parsing JSON 2024-11-29 10:50:49 +01:00
tests Add Exceptions indicating which line contains error when parsing JSON 2024-11-29 10:50:49 +01:00
.gitignore first commit 2024-11-19 16:42:04 +01:00
CMakeLists.txt Remove CMAKE Slint config 2025-06-24 17:00:53 +02:00
README.md Add 'remove' methods to Object and Array + unify 'set' methods 2024-11-22 17:53:00 +01:00

rei-cpp

Warning

This is a work in progress, not stable and the API might change.

A C++ JSON library.

Example

#include "rei-json/json.h"
#include <print>

int main() {
	auto objectJson = rei::json::JsonObject{};
	objectJson
		.set("keyPositiveNumber", 12)
		.set("keyNegativeNumber", -13)
		.set("keyBooleanTrue", true)
		.set("keyBooleanFalse", false)
		.set("keyString", "YEP")
		.set("keyEmptyString", "")
		.setNull("keyNull");

	rei::json::JsonObject obj{};
	obj.set("keyNumberOnObject", 42);

	rei::json::JsonArray array{};
	array.push(42);
	array.push("elemString");
	array.push("");
	array.push(true);
	array.push(false);
	array.pushNull();

	objectJson.set("keyObject", std::move(obj));
	objectJson.set("keyArray", std::move(array));

	auto newJsonString = rei::json::toString(objectJson);
	std::println("{}\n", newJsonString);

	return 0;
}