mirror of
https://github.com/nlohmann/json.git
synced 2025-05-11 05:33:55 +00:00
* 🔥 consolidate documentation * ♻️ overwork std specializations * 🚚 move images files to mkdocs * ♻️ fix URLs * 🔧 tweak MkDocs configuration * 🔧 add namespaces * 📝 document deprecations * 📝 document documentation generation * 🚸 improve search * 🚸 add examples * 🚧 start adding documentation for macros * 📝 add note for https://github.com/nlohmann/json/issues/874#issuecomment-1001699139 * 📝 overwork example handling * 📝 fix Markdown tables
1.2 KiB
1.2 KiB
nlohmann::adl_serializer::from_json
// (1)
template<typename BasicJsonType, typename TargetType = ValueType>
static auto from_json(BasicJsonType && j, TargetType& val) noexcept(
noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val)))
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void())
// (2)
template<typename BasicJsonType, typename TargetType = ValueType>
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 explicit or via conversion operators).
- This function is chosen for default-constructible value types.
- This function is chosen for value types which are not default-constructible.
Parameters
j
(in)- JSON value to read from
val
(out)- value to write to
Return value
Copy of the JSON value, converted to ValueType
!!! note
This documentation page is a stub.
Version history
- Added in version 2.1.0.