0

我的 gitlab 服务器中有一个像这样的 .yml 文件

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

配置服务器读取上面的 yml 并返回类似这样的响应

{"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"}

我需要配置服务器返回如下所示的“源”部分

{"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"
       ]
    }
  }

有人可以帮我解决这个问题吗?

4

1 回答 1

0

试试这个

输入 YAML

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

返回的 JSON

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

我认为这符合您的要求

于 2020-07-30T16:28:27.253 回答