-
Is it just copy the binary data to the json or just delete the invalid utf-8 bytes ? json j;
std::string data(ptr, n); // binary data.
j["some_data"] = data;
return j.dump(-1, ' ', false, json::error_handler_t::ignore); // can i use this param to pass binary data? thanks for the answer : )Through the test, I found that this method can't work : ( for(auto each : str) {
j["binary"].push_back(each); // str.size() : 2KB ~ 4KB.
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
The Update: #2232 |
Beta Was this translation helpful? Give feedback.
-
What exactly do you try to accomplish? I am asking, because the library has support for binary types, but I would need to understand your usecase better. |
Beta Was this translation helpful? Give feedback.
The
ignore
parameter copies invalid UTF-8 bytes verbatim to the output. Maybe the name is not too optimal - I will adjust the documentation.Update: #2232