// Copyright (c) 2026 Juhapekka Piiroinen // All Rights Reserved. // AmoosedWeb project: https://amoosed.com #pragma once #include #include #include #include #include namespace amoosed { struct Json { enum class Type { Null, Boolean, Number, String, Array, Object } type = Type::Null; std::string scalar; std::vector array; std::map object; const Json* field(std::string_view name) const; bool string(std::string& value) const; bool unsigned_integer(std::size_t& value) const; }; // Parses bounded UTF-8 JSON, rejects duplicate keys, excess nesting, invalid // escapes and nonfinite numbers. The caller supplies the maximum document size. bool parse_json(std::string_view input, std::size_t max_bytes, Json& output, std::string& error); }