#pragma once #include #include #include namespace reginfo { // Minimal JSON object for flat string key/value pairs. // Supports only string values — sufficient for license data. class JsonObject { public: void set(const std::string& key, const std::string& value) { data_[key] = value; } std::string get(const std::string& key) const { auto it = data_.find(key); if (it == data_.end()) throw std::runtime_error("Missing JSON key: " + key); return it->second; } std::string get(const std::string& key, const std::string& defaultValue) const { auto it = data_.find(key); return (it != data_.end()) ? it->second : defaultValue; } bool contains(const std::string& key) const { return data_.find(key) != data_.end(); } // Parse from JSON string like {"key":"value",...} static JsonObject parse(const std::string& json); // Serialize to JSON string std::string dump(bool pretty = false) const; const std::map& data() const { return data_; } private: std::map data_; }; } // namespace reginfo