I did this once but it’s a bit of a hack.
The idea is to use Hugo modules to make the json file look like a regular page which will then have lastmod.