When my keycaps get dirty I just clean them in a dishwasher on the "eco" setting that is slightly lower temperature than usual. I put them in those bags you use to wash your sneakers. After an hour, they're clean like new.
Only time I had problem was when I cleaned stock Filco keycaps this way. They didn't melt but got discolored in a nasty way, but they were crap quality anyways. Not sure why I even bothered washing them

I do that regularly on black Topre keys (HHKB and Realforce), white Topre keys (HHKB), IBM Model M/F keycaps and charcoal EnjoyPBT blanks from Gateron as those are the things I use mostly.