Just measure the spoke end to end and buy a replacement. Get the same gauge so it matches the nipple and/or buy a matching nipple to be sure. J-bend spokes measure from the bend.
Take the spoke with you to a shop.
If it's on the drive side you'll need to remove the cassette /freewheel first.
Large cogs may also get in the way of non-drive side spokes.