在Azure应用程序配置中,我们以键值对的形式存储值。通常,我们将字符串值存储在键值对中,例如:
"key" : "red"
但我想将 map 存储为如下值:
"key" : {
1: {1,2,3},
2: {1,4}
}
在我的 spring-boot 应用程序中,我会将变量读取为 Map
最佳答案
您可以Leverage content-type to store JSON key-values in App Configuration .
Data is stored in App Configuration as key-values, where values are treated as the string type by default. However, you can specify a custom type by leveraging the content-type property associated with each key-value, so that you can preserve the original type of your data or have your application behave differently based on content-type.
Valid JSON values
When a key-value has JSON content-type, its value must be in valid JSON format for clients to process it correctly. Otherwise, clients may fail or fall back and treat it as string format. Some examples of valid JSON values are:
- "John Doe"
- 723
- false
- null
- "2020-01-01T12:34:56.789Z"
- [1, 2, 3, 4]
- {"ObjectSetting":{"Targeting":{"Default":true,"Level":"Information"}}}
关于azure - 如何在Azure应用程序配置中添加 map ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69725478/