1# <small>nlohmann::</small>operator""_json_pointer 2 3```cpp 4json_pointer operator ""_json_pointer(const char* s, std::size_t n); 5``` 6 7This operator implements a user-defined string literal for JSON Pointers. It can be used by adding `#!cpp _json_pointer` 8to a string literal and returns a [`json_pointer`](json_pointer/index.md) object if no parse error occurred. 9 10It is recommended to bring the operator into scope using any of the following lines: 11```cpp 12using nlohmann::literals::operator ""_json_pointer; 13using namespace nlohmann::literals; 14using namespace nlohmann::json_literals; 15using namespace nlohmann::literals::json_literals; 16using namespace nlohmann; 17``` 18This is suggested to ease migration to the next major version release of the library. See 19['JSON_USE_GLOBAL_UDLS`](macros/json_use_global_udls.md#notes) for details. 20 21## Parameters 22 23`s` (in) 24: a string representation of a JSON Pointer 25 26`n` (in) 27: length of string `s` 28 29## Return value 30 31[`json_pointer`](json_pointer/index.md) value parsed from `s` 32 33## Exceptions 34 35The function can throw anything that [`json_pointer::json_pointer`](json_pointer/index.md) would throw. 36 37## Complexity 38 39Linear. 40 41## Examples 42 43??? example 44 45 The following code shows how to create JSON Pointers from string literals. 46 47 ```cpp 48 --8<-- "examples/operator_literal_json_pointer.cpp" 49 ``` 50 51 Output: 52 53 ```json 54 --8<-- "examples/operator_literal_json_pointer.output" 55 ``` 56 57## See also 58 59- [json_pointer](json_pointer/index.md) - type to represent JSON Pointers 60 61## Version history 62 63- Added in version 2.0.0. 64- Moved to namespace `nlohmann::literals::json_literals` in 3.11.0. 65