A C++ JSON library
Find a file
2025-09-07 10:41:15 +02:00
include/rei-json Add 'at' method with checks to json array 2025-07-06 10:41:13 +02:00
src Add 'at' method with checks to json array 2025-07-06 10:41:13 +02:00
tests Split CMakeLists.txt 2025-07-06 18:56:09 +02:00
.gitignore first commit 2024-11-19 16:42:04 +01:00
CMakeLists.txt Add PIC compilation flag 2025-09-07 10:41:15 +02:00
README.md Update README example 2025-07-06 10:02:41 +02: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 object_json = rei::json::json_object{};
	object_json
		.set("keyPositiveNumber", 12)
		.set("keyNegativeNumber", -13)
		.set("keyBooleanTrue", true)
		.set("keyBooleanFalse", false)
		.set("keyString", "YEP")
		.set("keyEmptyString", "")
		.set_null("keyNull");

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

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

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

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

	return 0;
}