If there is a config section like below in AppSetting.json and the APP runtime is .NET Core 2.x, no exception occurred and the value of AllowedHosts should be the last one, but when I upgrade to .NET Core 3.1, the exception occurred.
I have checked he document from Microsoft site, per the document below, the code behavior should be same between .NET Core 2.x and .NET Core 3.1
Configuration keys and values
Are case-insensitive. For example, ConnectionString and connectionstring are treated as equivalent keys.
If a key and value is set in more than one configuration providers, the value from the last provider added is used. For more information, see Default configuration.
Within the Configuration API, a colon separator (:) works on all platforms.
In environment variables, a colon separator may not work on all platforms. A double underscore, __, is supported by all platforms and is automatically converted into a colon :.
In Azure Key Vault, hierarchical keys use -- as a separator. The Azure Key Vault configuration provider automatically replaces -- with a : when the secrets are loaded into the app's configuration.
The ConfigurationBinder supports binding arrays to objects using array indices in configuration keys. Array binding is described in the Bind an array to a class section.
Null values can't be stored in configuration or bound to objects.