Spring config server returns json response with resolved paths - how to avoid this?

689 Views Asked by At

I have a .yml file like this in my gitlab server

   holidays:  
   US:  
     - 03/19/2020  
     - 03/20/2020  
     - 05/18/2020

the config server reads the above yml and returns something the response like this

{"name":"*****","profiles":["simpleyml"],"label":null,"version":"*****","state":null,"propertySources":[{"name":"https://*****.com/****.git/application-simpleyml.yml",source":{"holidays.US[0]":"03/19/2020","holidays.US[1]":"03/20/2020"}

I would need the config server to return the "source" part like the below instead

{"name":"*****","profiles":["simpleyml"],"label":null,"version":"*****","state":null,"propertySources":[{"name":"https://*****.com/****.git/application-simpleyml.yml","source":
  {
    "holidays": {
      "US": [
        "03/19/2020",
        "03/20/2020"
       ]
    }
  }

Could someone please help me out on this?

1

There are 1 best solutions below

4
On

Try this out

Input YAML

source:
 holidays:
  US:
    - 03/19/2020
    - 03/20/2020

Returned JSON

{ "source": { "holidays": { "US": [ "03/19/2020", "03/20/2020" ] } } }

I think this matches your requirement