Files
2024-09-19 01:20:23 +08:00

35 lines
628 B
C++

#include <string>
#include <unordered_map>
#include <vector>
#include <cstdint>
namespace JsonParser {
enum JsonType {
BOOLEAN,
NUMBER,
INTEGER,
STRING,
OBJECT,
ARRAY,
NULL_VALUE
};
union JsonValueValue {
bool boolean;
double number;
int64_t integer;
std::string *string;
std::unordered_map<std::string, struct JsonValue> *object;
std::vector<struct JsonValue> *array;
};
struct JsonValue {
enum JsonType type;
JsonValueValue value;
};
JsonValue parse(const char* input);
}