16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_JSON_JSONUTILS_H_
17 #define ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_JSON_JSONUTILS_H_
24 #include <rapidjson/document.h>
52 const rapidjson::Value& jsonNode,
53 const std::string&
key,
54 rapidjson::Value::ConstMemberIterator* iteratorPtr);
63 bool parseJSON(
const std::string& jsonContent, rapidjson::Document* document);
72 bool convertToValue(
const rapidjson::Value& documentNode, std::string* value);
81 bool convertToValue(
const rapidjson::Value& documentNode, int64_t* value);
91 bool convertToValue(
const rapidjson::Value& documentNode, uint64_t* value);
100 bool convertToValue(
const rapidjson::Value& documentNode,
bool* value);
109 bool convertToValue(
const rapidjson::Value& documentNode,
double* value);
123 template <
typename T>
130 rapidjson::Value::ConstMemberIterator iterator;
149 template <
typename T>
156 rapidjson::Document document;
190 template <
class CollectionT>
203 template <
class CollectionT>
213 template <
class CollectionT>
222 template <
class CollectionT>
233 std::map<std::string, std::string>
retrieveStringMap(
const rapidjson::Value& value,
const std::string&
key);
244 const rapidjson::Value& value,
245 const std::string&
key,
246 std::map<std::string, std::string>& elements);
258 const rapidjson::Value& value,
259 const std::string&
key,
260 std::vector<std::map<std::string, std::string>>& elements);
265 std::vector<std::string> retrieveStringArray<std::vector<std::string>>(
266 const std::string& jsonString,
267 const std::string&
key);
270 std::vector<std::string> retrieveStringArray<std::vector<std::string>>(
const std::string& jsonString);
273 std::vector<std::string> retrieveStringArray<std::vector<std::string>>(
const rapidjson::Value& value);
276 std::string convertToJsonString<std::vector<std::string>>(
const std::vector<std::string>& elements);
278 template <
class CollectionT>
280 auto values = retrieveStringArray<std::vector<std::string>>(jsonString,
key);
281 return CollectionT{values.begin(), values.end()};
284 template <
class CollectionT>
286 auto values = retrieveStringArray<std::vector<std::string>>(jsonString);
287 return CollectionT{values.begin(), values.end()};
290 template <
class CollectionT>
292 auto values = retrieveStringArray<std::vector<std::string>>(value);
293 return CollectionT{values.begin(), values.end()};
296 template <
class CollectionT>
307 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_JSON_JSONUTILS_H_