API responses and LLM tool outputs are deeply nested JSON. Write a safe accessor: get_path(data, "user.addresses.0.city", default=None).
.. For dicts, look up the key. For lists, the segment must be an integer index (negative indices allowed).default instead of raising.data itself.Then implement set_path(data, path, value), which sets a value and creates missing dicts along the way. Numeric segments into existing lists set by index. set_path modifies data in place and returns it.