diff --git a/README.md b/README.md index 1ee358e5b..6451e2c55 100644 --- a/README.md +++ b/README.md @@ -563,7 +563,9 @@ namespace nlohmann { } static void from_json(const json& j, boost::optional& opt) { - if (!j.is_null()) { + if (j.is_null()) { + opt = boost::none; + } else { opt = j.get(); // same as above, but with // adl_serializer::from_json }