diff --git a/nlohmann::basicjson::get.md b/nlohmann::basicjson::get.md index 043aba7..bd66ba3 100644 --- a/nlohmann::basicjson::get.md +++ b/nlohmann::basicjson::get.md @@ -34,6 +34,32 @@ Amortized linear in the size of the JSON type. `std::std::logic_error` if types are not compatible. +## Example + +```cpp +#include +#include +#include +#include +#include +#include + +int main() +{ + nlohmann::json j1 = {1, 2, 3.2, 4.3, 5.4}; + auto v11 = j1.get>(); + auto v12 = j1.get>(); + auto v13 = j1.get>(); + + nlohmann::json j2 = {{"one", 1}, {"two", 2}, {"three", 3}}; + auto v21 = j2.get>(); + auto v22 = j2.get>(); + + nlohmann::json j3 = "Hello, world"; + auto v31 = j3.get(); +} +``` + ## See also -- [**(implicit value conversion)**](https://github.com/nlohmann/json/wiki/nlohmann::basicjson::operator-T()) +- [**(implicit value conversion)**](https://github.com/nlohmann/json/wiki/nlohmann::basicjson::operator-T()) \ No newline at end of file