1# basic_json::string_t 2 3```cpp 4using string_t = StringType; 5``` 6 7The type used to store JSON strings. 8 9[RFC 8259](https://tools.ietf.org/html/rfc8259) describes JSON strings as follows: 10> A string is a sequence of zero or more Unicode characters. 11 12To store objects in C++, a type is defined by the template parameter described below. Unicode values are split by the 13JSON class into byte-sized characters during deserialization. 14 15## Template parameters 16 17`StringType` 18: the container to store strings (e.g., `std::string`). Note this container is used for keys/names in objects, see 19 [object_t](object_t.md). 20 21## Notes 22 23#### Default type 24 25With the default values for `StringType` (`std::string`), the default value for `string_t` is `#!cpp std::string`. 26 27#### Encoding 28 29Strings are stored in UTF-8 encoding. Therefore, functions like `std::string::size()` or `std::string::length()` return 30the number of bytes in the string rather than the number of characters or glyphs. 31 32#### String comparison 33 34[RFC 8259](https://tools.ietf.org/html/rfc8259) states: 35> Software implementations are typically required to test names of object members for equality. Implementations that 36> transform the textual representation into sequences of Unicode code units and then perform the comparison numerically, 37> code unit by code unit, are interoperable in the sense that implementations will agree in all cases on equality or 38> inequality of two strings. For example, implementations that compare strings with escaped characters unconverted may 39> incorrectly find that `"a\\b"` and `"a\u005Cb"` are not equal. 40 41This implementation is interoperable as it does compare strings code unit by code unit. 42 43#### Storage 44 45String values are stored as pointers in a `basic_json` type. That is, for any access to string values, a pointer of type 46`string_t*` must be dereferenced. 47 48## Version history 49 50- Added in version 1.0.0. 51