85 T
get(const std::
string& key, const T& defaultValue) const noexcept
87 std::lock_guard lock{ m_mutex };
88 if constexpr (std::is_same_v<T, int>)
90 if(!m_json.contains(key) || !m_json[key].is_int64())
94 return static_cast<int>(m_json[key].as_int64());
96 else if constexpr (std::is_same_v<T, std::int64_t>)
98 if(!m_json.contains(key) || !m_json[key].is_int64())
102 return m_json[key].as_int64();
104 else if constexpr (std::is_same_v<T, double>)
106 if(!m_json.contains(key) || !m_json[key].is_double())
110 return m_json[key].as_double();
112 else if constexpr (std::is_same_v<T, bool>)
114 if(!m_json.contains(key) || !m_json[key].is_bool())
118 return m_json[key].as_bool();
120 else if constexpr (std::is_same_v<T, std::string>)
122 if(!m_json.contains(key) || !m_json[key].is_string())
126 return std::string(m_json[key].as_string());
128 else if constexpr (std::is_same_v<T, boost::json::array>)
130 if(!m_json.contains(key) || !m_json[key].is_array())
134 return m_json[key].as_array();
136 else if constexpr (std::is_same_v<T, boost::json::object>)
138 if(!m_json.contains(key) || !m_json[key].is_object())
142 return m_json[key].as_object();