comparison include/core/json.h @ 220:79a87a6dd39d

core/json: fix from_json oops.
author Paper <paper@paper.us.eu.org>
date Mon, 08 Jan 2024 11:56:09 -0500
parents bc1ae1810855
children 862d0d8619f6
comparison
equal deleted inserted replaced
219:2f6d27fcdf7d 220:79a87a6dd39d
17 } 17 }
18 18
19 template<typename T> 19 template<typename T>
20 void from_json(const nlohmann::json& j, std::optional<T>& v) 20 void from_json(const nlohmann::json& j, std::optional<T>& v)
21 { 21 {
22 return j.is_null() ? std::nullopt : j.get<T>(); 22 v = j.is_null() ? std::nullopt : j.get<T>();
23 } 23 }
24 24
25 } // namespace nlohmann 25 } // namespace nlohmann
26 26
27 namespace JSON { 27 namespace JSON {