常用的配置文件格式

741 阅读1分钟
  • 配置文件yaml,toml,json,xml,hjson,properties
    • yaml 没有快速检查格式的能力,如空格,减号很让人晕
    • json 缺乏注释
    • hjson 应用较少
    • xml 解析耗性能,又臭又长
    • toml>properties。toml大多数时候较好,但相对于yaml又没那么简洁,如下就感觉不如json和yaml
         [[fruits]]
         name = "Apple"
         weight = 600
         
         [[fruits]]
         name = "Banana"
         weight = 300
         
         [[fruits]]
         name = "Strawberry"
         weight = 40
      
    结论:按需使用