diff --git a/api/adl_serializer/from_json/index.html b/api/adl_serializer/from_json/index.html index b12ac5898..831d134c5 100644 --- a/api/adl_serializer/from_json/index.html +++ b/api/adl_serializer/from_json/index.html @@ -9,7 +9,7 @@ static auto from_json(BasicJsonType && j) noexcept( noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))) -> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {})) -
This function is usually called by the get()
function of the basic_json class (either explicitly or via the conversion operators).
j
(in)val
(out)Copy of the JSON value, converted to ValueType
The example below shows how a from_json
function can be implemented for a user-defined type. This function is called by the adl_serializer
when get<ns::person>()
is called.
#include <iostream>
+
This function is usually called by the get()
function of the basic_json class (either explicitly or via the conversion operators).
j
(in)val
(out)Copy of the JSON value, converted to ValueType
The example below shows how a from_json
function can be implemented for a user-defined type. This function is called by the adl_serializer
when template get<ns::person>()
is called.
#include <iostream>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
@@ -42,7 +42,7 @@
j["address"] = "744 Evergreen Terrace";
j["age"] = 60;
- auto p = j.get<ns::person>();
+ auto p = j.template get<ns::person>();
std::cout << p.name << " (" << p.age << ") lives in " << p.address << std::endl;
}
@@ -96,9 +96,9 @@
j["address"] = "744 Evergreen Terrace";
j["age"] = 60;
- auto p = j.get<ns::person>();
+ auto p = j.template get<ns::person>();
std::cout << p.name << " (" << p.age << ") lives in " << p.address << std::endl;
}
Output:
Ned Flanders (60) lives in 744 Evergreen Terrace
-