Getting the locked git hash from a given flake top-level input

I need to verify the locked git hash of a flake input against some other (non-Nix) git hash in our repo because reasons. I can find that git hash in flake.lock, but unfortunately the flake has more (transitive) inputs named the same way, so that input is actually one of <name>_<n>s, and I don’t see a good way to figure out which one is the top-level one.

In the nix flake metadata output I can easily tell the top-level one because it’s all displayed as a tree.

Any ideas how else to accomplish it that wouldn’t be too complex?