Why is JPY considered a "safe currency"? When the economic prospect around the world feels getting worse and/or getting higher uncertainty, usually the value of JPY is getting higher, because investors are said to start to buy JPY to shelter their money in a safer place. In some cases even if the bad economic prospect is not on US or Europe, it seems that JPY still tends to be stronger even compared to USD or EUR (e.g. near the French election this year or Brexit, JPY was getting stronger compared to USD).

But it seems ridiculous to think of JPY as a safe currency, given that Japan's insanely high amount of debt.

So what makes JPY considered so safe to buy in case the economic situation feels getting worse and/or getting higher uncertainty around the world? And is JPY a safe currency to begin with, even compared to other major currency such as USD, EUR, CHF, CHY, CAD, etc...?
Because:

they are a massive exporter, meaning their capital account is negative, and thus they own a lot of assets abroad. Therefore, as this site explains:


When a crisis erupts, the Japanese repatriate that money – they bring it back home. In that process, they’re selling assets in other currencies to buy yen. And at that point it’s a supply/demand issue. The supply of others currencies is rising as the Japanese pull out (those currencies fall in value) and demand for yen rises as the Japanese bring their money back home (the yen rises in value).


they have had and are likely to continue to have among the lowest interest rate in the world (-0.1% now). Therefore, as this site explains:


In what’s known as a carry trade, investors will borrow money in a low-interest rate environment and then invest that money in higher yielding assets from other countries. Japan’s long-standing policy of near-zero interest rates has caused it to become a major source of capital for these types of trades.
When uncertainty subsequently hits global markets, it can cause investors to unwind these trades, which then results in additional demand for the yen.


hoard behaviour + path dependence in financial markets. As the site above explains:


Part of the reason the yen continues to act as a safe-haven currency is simply because everyone acknowledges that it is. Investors around the world have come to embrace the yen as a reliable place to go for safety, and by attempting to take advantage of this, they actually create the intended effect.
If you know that whenever the world panics, the yen is going to rise, then it makes it a no-brainer to buy the yen even if you’re unsure exactly why everyone else is.

Some differ though. An IMF study concedes that:

Safe haven currencies tend to have low interest rates, a strong net foreign asset position, and deep and liquid financial markets. Japan meets all these criteria.

But they find that:

Surprisingly and in contrast to the experience of the Swiss Franc, yen risk-off appreciations appears unrelated to capital inflows (cross-border transactions) [large foreign asset ownership] and do not seem supported by expectations about the relative stance of monetary policies [low interest rate].

They state:

The third possibility is that risk-off appreciations of the yen come about because of portfolio rebalancing transactions that are not fully captured by BoP statistics, such as derivative transactions. For example, when risk perceptions change, exporters or overseas affiliates of Japanese companies may decide to lock in the exchange rate through hedging, or given Japan’s sizeable net foreign asset position, holders of foreign securities may take a long yen position. As such, these derivative transactions may not just reflect short-term speculative behavior, but may just reflect prudent risk management. We find support for this conjecture as risk-off episodes are associated with increases in net non-commercial exposures to the yen in the derivatives market.