How to escape indicator characters (i.e. : or - ) in YAML

后端 未结 7 2241
醉话见心
醉话见心 2020-11-27 12:13

In a config file, I have a key to which I wish to assign a URL. The problem is that YAML interprets : and - characters as either creating mappings or lists, so it has a pro

7条回答
  •  一向
    一向 (楼主)
    2020-11-27 12:37

    Quotes, but I prefer them on the just the value:

    url: "http://www.example.com/"
    

    Putting them across the whole line looks like it might cause problems.

提交回复
热议问题