Replies: 1 comment 1 reply
-
|
This has been substantially addressed since: include/nlohmann/json.hpp now provides a This reply was drafted by Claude Code on behalf of @nlohmann, as part of a review of open discussions. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This is a feature request. I wondered if this is possible. The JSON format is UTF-8. C++11 added
char16_tandchar32_tfor unicode characters, and lately C++20 addedchar8_t.Since JSON is specified as UTF-8, this library should at least support
char8_t. This add more safety since we can validate and check the character encoding at compile time, prohibiting sending strings to functions that expects another encoding.What is the issue you have?
Right now, trying to use
char8_twithstd::u8stringin abasic_jsonresult in error.Please describe the steps to reproduce the issue.
using u8json = basic_json<std::map, std::vector, std::u8string>; u8json value = {};Compiler explorer link
What is the expected behavior?
The
u8jsonalias should work, and conversions tostd::u8stringandstd::u8string_viewshould work instead ofstd::stringusing this alias.And what is the actual behavior instead?
A compilation error.
Which compiler and operating system are you using?
Which version of the library did you use?
developbranchIf you experience a compilation error: can you compile and run the unit tests?
Beta Was this translation helpful? Give feedback.
All reactions