8#ifndef DISCORD_IPC_CPP_INCLUDE_DISCORD_IPC_CPP_JSON_HPP_
9#define DISCORD_IPC_CPP_INCLUDE_DISCORD_IPC_CPP_JSON_HPP_
74 using JSONValue = std::variant<
98 void stringify(std::ostream& os)
const;
130 explicit JSON(
const char* value);
Basic abstract JSON item.
Definition json.hpp:69
bool has(const JSONString &key) const
Checks current JSON for key.
void push_back(const JSON &item)
Appends item to current JSON.
std::string to_string() const
Stringifies JSON object.
JSON()
Creates an empty JSON object.
const JSON & operator[](const JSONString &key) const
Retrieve a nested value.
JSON(const JSONArray &value)
Creates an array JSON item.
T as() const
Retrieve the current JSON item as a specific type.
JSON(const char *value)
Creates a string JSON item.
const std::optional< JSON > safe_at(const JSONString &key) const
Retrieves a nested value safely.
std::optional< T > safe_as() const
Retrieve the current JSON item as a specific type.
JSON(const JSONObject &value)
Creates another nested JSON item.
bool is() const
Checks current JSON item type.
JSON(JSONInt value)
Creates a number JSON item.
JSON & operator[](const JSONString &key)
Retrieve a nested value.
JSON(JSONLong value)
Creates a number JSON item.
JSON(const JSONString &value)
Creates a string JSON item.
JSON(JSONNull value)
Creates a null JSON item.
JSON(JSONBool value)
Creates a bool JSON item.
JSON(JSONDouble value)
Creates a number JSON item.
Custom JSON implementation.
std::map< std::string, JSON > JSONObject
Representation of a key-value pair.
Definition json.hpp:57
bool JSONBool
Representation of bool.
Definition json.hpp:53
int64_t JSONLong
Representation of number.
Definition json.hpp:45
int JSONInt
Representation of number.
Definition json.hpp:41
double JSONDouble
Representation of number.
Definition json.hpp:49
std::nullptr_t JSONNull
Representation of null.
Definition json.hpp:33
std::vector< JSON > JSONArray
Representation of array.
Definition json.hpp:61
std::string JSONString
Representation of string.
Definition json.hpp:37