#pragma once #include #include #include #include namespace jsonlite { struct Value { enum class Type { Null, Bool, Number, String }; Type type = Type::Null; bool b = false; double n = 0.0; std::string s; static Value Null() { return Value{}; } static Value Bool(bool v) { Value x; x.type = Type::Bool; x.b = v; return x; } static Value Number(double v) { Value x; x.type = Type::Number; x.n = v; return x; } static Value String(std::string v) { Value x; x.type = Type::String; x.s = std::move(v); return x; } }; using Object = std::unordered_map; bool ParseObject(const std::string& input, Object& out, std::string& err); std::string EscapeString(const std::string& s); } // namespace jsonlite