json::JObject added method putArray

This commit is contained in:
MihailRis 2023-12-01 16:56:07 +03:00
parent c8a283c645
commit 647662b0d3
2 changed files with 7 additions and 0 deletions

View File

@ -295,6 +295,12 @@ JObject& JObject::put(string key, bool value){
return *this;
}
JArray& JObject::putArray(std::string key) {
JArray* arr = new JArray();
put(key, arr);
return *arr;
}
bool JObject::has(string key) {
return map.find(key) != map.end();
}

View File

@ -87,6 +87,7 @@ namespace json {
JObject& put(std::string key, JObject* value);
JObject& put(std::string key, JArray* value);
JObject& put(std::string key, bool value);
JArray& putArray(std::string key);
bool has(std::string key);
};