Random encounter json location

I dug the data file for a while and couldn’t find the JSON file for the random encounter (random corpse etc)
anyone know where is their location?
thank you

Most functions there are hardcoded in https://github.com/CleverRaven/Cataclysm-DDA/blob/edd25980d0ca793ba11a7c37931a002c29f5e387/src/map_extras.cpp

Is it possible to add a random encounter through JSON?

Sure, check out how I did it here

Is it possible, and if so how, to migrate the existing mapgen encounters into a modification for editing?

It’s kind of possible, you just have to understand how the C++ works and recode it in JSON. Or you could do like what I’ve done for c++ based maps and just redo it by hand. None of the old C++ maps really do anything we can’t do manually now.