MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / QueryJson

Function QueryJson

lib/utils/json-helpers.cpp:64–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64std::optional<std::string> QueryJson(const std::string &jsonStr,
65 const std::string &query)
66{
67#ifdef JSONPATH_SUPPORT
68 try {
69 auto json = jsoncons::json::parse(jsonStr);
70 auto result = jsoncons::jsonpath::json_query(json, query);
71 return result.as_string();
72 } catch (const jsoncons::json_exception &) {
73 return {};
74 } catch (const jsoncons::json_errc &) {
75 return {};
76 }
77#else
78 return {};
79#endif
80}
81
82std::optional<std::string> AccessJsonArrayIndex(const std::string &jsonStr,
83 const int index)

Callers 2

PerformActionMethod · 0.85
test-json.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected