I want to replace one half of this with longer wire, but I am not confident about the name of the connector used.
Image of JST-XH included to convey size. Ruler is metric.
This isn’t an easy question https://www.mattmillman.com/info/crimpconnectors/common-jst-connector-types/
Your 2nd best bet would be to get the pin spacing, and filter your search using that.
Your first best bet would be to just replace both ends.
I settled on a ‘standard’ and just bought a massive kit of each of those connector types- wire-wire, wire-board, wire-panel in M and F, in various pole counts. Buy once, cry once.
Molex 51021 or similar. Could you measure the pin pitch?
A 2-pin connector?
Yes, 2 pins.
I think they’re saying that’s generally what it’s called.
Why not just splice the wire?
This is by far the best option for awkward connectors. You could even remove the pins and put the new cables in by opening the crimp and soldering the new ones without any splice.