0

In the Azure App Configuration, we store value in the form of key-value pair. Generally, we store string values in the key-value pair like:

    "key" : "red"

But I want to store map in value like:

    "key" : {
               1: {1,2,3},
               2: {1,4}
             }

In my spring-boot application, I will read the variable as Map<integer, List>

suraj jain
  • 21
  • 6

1 Answers1

2

You can 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"}}}
rickvdbosch
  • 14,105
  • 2
  • 40
  • 53
  • In the spring-boot application, I am getting this error when I received the value: Description: Failed to bind properties under 'config.cold-chain-compliance-map' to java.util.Map>>: Reason: No converter found capable of converting from type [java.lang.String] to type [java.util.Map>>] Action: Update your application's configuration – suraj jain Oct 27 '21 at 08:22