Reconstructing an issue's JSON (from Jira Server REST API) at a timestamp in the past

Using the Jira server REST API I can get the JSON formatted data for an issue,
including its full changelog and mappings to more readable names for its
custom field names, like this:


The changelog is a time ordered array of changes/edits that have been
made to the issue. I would like to be able to take this JSON formatted data
for an issue, along with a timestamp, and “unwind” its changelog (i.e. undo
the specified changes in the changelog that were done after the given
timestamp) to generate what the JSON for the issue WOULD have looked like at
that timestamp. I would also like to do similarly for the comments of the issue
(which are also sorted in time order). How can I do this? Is there a plugin
that would do this for me? Or has someone implemented this somewhere (e.g.
point me at a GitHub repo, etc.) I started just implementing this myself, but
it isn’t as straightforward as I would have thought (e.g. Labels are stored
in fields as an array, but the changelog gives them as simple strings, and
there are other non-obvious transformations you’d have to do to turn the
changelog record into how the fields should be changed). Thanks for any
pointers or guidance you can give!