Lines Matching refs:jsonObj
87 bool IsString(const nlohmann::json &jsonObj, const std::string &key)
89 bool res = jsonObj.contains(key) && jsonObj[key].is_string() && jsonObj[key].size() <= MAX_MESSAGE_LEN;
91 LOGE("the key %{public}s in jsonObj is invalid.", key.c_str());
96 bool IsInt32(const nlohmann::json &jsonObj, const std::string &key)
98 bool res = jsonObj.contains(key) && jsonObj[key].is_number_integer() && jsonObj[key] >= INT32_MIN &&
99 jsonObj[key] <= INT32_MAX;
101 LOGE("the key %{public}s in jsonObj is invalid.", key.c_str());
106 bool IsUint32(const nlohmann::json &jsonObj, const std::string &key)
108 bool res = jsonObj.contains(key) && jsonObj[key].is_number_unsigned() && jsonObj[key] >= 0 &&
109 jsonObj[key] <= UINT32_MAX;
111 LOGE("the key %{public}s in jsonObj is invalid.", key.c_str());
116 bool IsInt64(const nlohmann::json &jsonObj, const std::string &key)
118 bool res = jsonObj.contains(key) && jsonObj[key].is_number_integer() && jsonObj[key] >= INT64_MIN &&
119 jsonObj[key] <= INT64_MAX;
121 LOGE("the key %{public}s in jsonObj is invalid.", key.c_str());
126 bool IsArray(const nlohmann::json &jsonObj, const std::string &key)
128 bool res = jsonObj.contains(key) && jsonObj[key].is_array();
130 LOGE("the key %{public}s in jsonObj is invalid.", key.c_str());
135 bool IsBool(const nlohmann::json &jsonObj, const std::string &key)
137 bool res = jsonObj.contains(key) && jsonObj[key].is_boolean();
139 LOGE("the key %{public}s in jsonObj is invalid.", key.c_str());
152 nlohmann::json jsonObj;
154 jsonObj[it.first] = it.second;
156 jsonStr = jsonObj.dump();