Lines Matching refs:jsonValue
33 bool JsonUtils::LoadJsonValueFromContent(nlohmann::json& jsonValue, const std::string& content)
39 jsonValue = nlohmann::json::parse(content, nullptr, false);
40 if (jsonValue.is_discarded()) {
44 if (!jsonValue.is_object()) {
51 bool JsonUtils::LoadJsonValueFromFile(nlohmann::json& jsonValue, const std::string& filePath)
62 jsonValue = nlohmann::json::parse(content, nullptr, false);
63 if (jsonValue.is_discarded()) {
67 if (!jsonValue.is_object()) {
74 bool JsonUtils::DumpJsonValueToFile(const nlohmann::json& jsonValue, const std::string& filePath)
91 fout << jsonValue.dump(JSON_FORMAT).c_str() << std::endl;
116 bool JsonUtils::GetInt32FromJsonValue(const nlohmann::json& jsonValue, const std::string& key, int32_t& value)
118 if (jsonValue.empty() || key.empty()) {
121 if (jsonValue.contains(key) == 0 || !jsonValue.at(key).is_number_integer()) {
124 value = jsonValue.at(key).get<int32_t>();
128 bool JsonUtils::GetBoolFromJsonValue(const nlohmann::json& jsonValue, const std::string& key, bool& value)
130 if (jsonValue.empty() || key.empty()) {
133 if (jsonValue.contains(key) == 0 || !jsonValue.at(key).is_boolean()) {
136 value = jsonValue.at(key).get<bool>();
140 bool JsonUtils::GetStringFromJsonValue(const nlohmann::json& jsonValue, const std::string& key, std::string& value)
142 if (jsonValue.empty() || key.empty()) {
145 if (jsonValue.contains(key) == 0 || !jsonValue.at(key).is_string()) {
148 value = jsonValue.at(key).get<std::string>();
152 bool JsonUtils::GetObjFromJsonValue(const nlohmann::json& jsonValue, const std::string& key, nlohmann::json& value)
154 if (jsonValue.empty() || key.empty()) {
157 if (jsonValue.contains(key) == 0 || !jsonValue.at(key).is_object()) {
160 value = jsonValue.at(key);
164 bool JsonUtils::GetArrayFromJsonValue(const nlohmann::json& jsonValue, const std::string& key, nlohmann::json& value)
166 if (jsonValue.empty() || key.empty()) {
169 if (jsonValue.contains(key) == 0 || !jsonValue.at(key).is_array()) {
172 value = jsonValue.at(key);
176 bool JsonUtils::GetStrArrFromJsonValue(const nlohmann::json& jsonValue, const std::string& key,
180 if (!JsonUtils::GetArrayFromJsonValue(jsonValue, key, strArrayValue)) {