No, you will not. Japan has banned entry of all foreigners who have travelled to Zhejiang and Hubei provinces within 14 days of travelling to Japan, but Shanghai, a provincial-level city, does not belong to either. You are (so far) safe.
It is, nevertheless, highly possible that Japan will soon extend this travel ban to the entirety of China. Keep updated. As a comment suggests, you are encouraged to keep an eye on the Timatic news feed, as well as the news.
Note: Take care of where is your next destination (transit or otherwise). For example, if it is Singapore and its within 14 days, Singapore will deny you transit or entry for the 2 hour you spent in China.
Credit:stackoverflow.com‘
5 Mar, 2024
5 Mar, 2024