#pragma once #include #include #include #include namespace connector { class Json { public: using Array = std::vector; using Object = std::map; Json(); Json(std::nullptr_t); Json(bool value); Json(double value); Json(const char* value); Json(std::string value); Json(Array value); Json(Object value); static Json parse(const std::string& text); std::string dump(int indent = -1) const; bool is_null() const; bool is_bool() const; bool is_number() const; bool is_string() const; bool is_array() const; bool is_object() const; bool boolean(bool fallback = false) const; double number(double fallback = 0) const; const std::string& string() const; const Array& array() const; Array& array(); const Object& object() const; Object& object(); const Json* find(const std::string& key) const; Json* find(const std::string& key); Json& operator[](const std::string& key); private: using Value = std::variant; Value value_; }; } // namespace connector