Merge branch 'develop' of https://github.com/nlohmann/json into bon8

 Conflicts:
	docs/examples/to_bon8.cpp
	docs/examples/to_bon8.output
	docs/mkdocs/docs/api/basic_json/to_bon8.md
	include/nlohmann/detail/input/binary_reader.hpp
	include/nlohmann/detail/input/input_adapters.hpp
	include/nlohmann/detail/output/binary_writer.hpp
	single_include/nlohmann/json.hpp
	test/CMakeLists.txt
	tests/src/unit-binary_formats.cpp
	tests/src/unit-bon8.cpp
This commit is contained in:
Niels Lohmann
2022-05-01 18:46:44 +02:00
925 changed files with 15696 additions and 7756 deletions

21
docs/examples/to_bon8.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include <iostream>
#include <iomanip>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main()
{
// create a JSON value
json j = R"({"compact": true, "schema": 0})"_json;
// serialize it to BON8
std::vector<uint8_t> v = json::to_bon8(j);
// print the vector content
for (auto& byte : v)
{
std::cout << "0x" << std::hex << std::setw(2) << std::setfill('0') << (int)byte << " ";
}
std::cout << std::endl;
}