|
|
std::optional< json > | neograph::llm::json_path::at_path (const json &root, const std::string &path) |
| | Navigate into root by dot-path. Returns nullopt if path doesn't resolve.
|
| |
|
template<typename T > |
| T | neograph::llm::json_path::get_path (const json &root, const std::string &path, const T &default_val) |
| | Fetch value at path or return default_val on missing/wrong-type.
|
| |
|
bool | neograph::llm::json_path::has_path (const json &root, const std::string &path) |
| | True if path exists in root.
|
| |
|
bool | neograph::llm::json_path::is_index (const std::string &s) |
| | True if every char is a digit.
|
| |
|
void | neograph::llm::json_path::set_path (json &root, const std::string &path, const json &value) |
| | Set value at path, creating intermediate objects as needed.
|
| |
|
std::vector< std::string > | neograph::llm::json_path::split_path (const std::string &path) |
| | Split "a.b.0.c" into ["a","b","0","c"].
|
| |
JSON dot-path navigation utilities.
Provides functions for navigating and manipulating JSON objects using dot-notation paths like "choices.0.message.content". Numeric segments are treated as array indices.
Unlike the prior nlohmann-based version (which returned raw const json* pointers into the parent document), these functions return std::optional<json> since our yyjson-backed handles are lightweight value types sharing the underlying document via shared_ptr.
Definition in file json_path.h.