When you see ammo “cooking off*” in movies, it’s portrayed as hugely dangerous, like the bullets are firing as if they were in a gun.
But that’s not actually what happens**. The bullet needs something to “push against” to actually fire, and is greatly accelerated by the barrel of the weapon it’s fired from.
When ammo cooks off, it’s the casing that gains speed (think about why, it’s easy!) and is the part that’s dangerous, though usually not very dangerous as compared to a bullet fired from a gun.
Anyway, no matter that it’s not all that risky, you still shouldn’t throw ammo in a fire. While a .22 LR brass might not really hurt you, as the cartridge gets bigger so does the M x A of the casing.
*Cooking off generally refers to ammo that fires from being overheated, but here I am using it to refer to any “outside of the chamber” firing.
**Source: grew up a a redneck in rural N. Florida where I have seen ammo thrown in a fire, and was in the US Army for five years.