I wouldn't say switching career exactly. I'd worked with asset management software for utilities and telecoms a good twenty years, it used a propriatory language no one outside the industry recognised. I got made redundant from my company, and getting another job in the field would have required moving country. TBH, I was thoroughly bored of the field anywsy, and was starting to see my career ending as some aging beardy in a server room looking after a valuable database no one could upgrade anymore.
I switched to mobile dev, although still in a related field. Well, I didn't just start out that way, to keep myself occupied during redundancy, i developed some fun stuff I was doing on MacOS, someone liked it and wondered if they could do the same on their iPhone, so I worked out how to do that.
I put several years of time into it, it wasn't a very successful project for making money, but it gave me something to demonstrate when applying for mobile jobs at the age of 43, and eventually landed me a job.
I had plenty of related experience I suppose and soon started making an impression in my new line, now I work on an app I developed and proposed myself to the company. I feel happier I work with more modern languages, that I can come up with an app a company thought had enough potential to invest time and money in, and is slowly starting to get successful and has an impact in my industry.