What is the issue you have?
When compiling the following code with the latest development branch
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
int main() {
json input;
input["test"] = "toast";
std::vector<uint8_t> output = json::to_ubjson(input);
json j = json::from_bson(output);
std::cout << j << std::endl;
return 0;
}
I get an error like
libc++abi: terminating with uncaught exception of type nlohmann::detail::parse_error: [json.exception.parse_error.110] parse error at byte 17: syntax error while parsing BSON cstring: unexpected end of input
This code simply combines the examples from json::to_ubson and json::from_ubson.
Therefore I guess one of the following:
- I made a mistake
- The examples in these two functions should be updated
- There is a bug in the library.
What is the expected behavior?
I think, this should work and write out
Which compiler and operating system are you using?
- Compiler: both clang++ 11 and g++ 10
- Operating system: Debian
Which version of the library did you use?
In case it is 1. from above, please let me know. If it is one of the others, I'm happy to help debug this, if that's useful.
What is the issue you have?
When compiling the following code with the latest development branch
I get an error like
This code simply combines the examples from json::to_ubson and json::from_ubson.
Therefore I guess one of the following:
What is the expected behavior?
I think, this should work and write out
{ "test:"toast" }Which compiler and operating system are you using?
Which version of the library did you use?
developbranchIn case it is 1. from above, please let me know. If it is one of the others, I'm happy to help debug this, if that's useful.