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

后端 未结 7 2270
醉话见心
醉话见心 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:26

    Quotes:

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

    To clarify, I meant “quote the value” and originally thought the entire thing was the value. If http://www.example-site.com/ is the value, just quote it like so:

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

提交回复
热议问题