yaml = Yaml Ain't Markup Language(Yaml은 마크업 언어가 아니다)
이며 또 다른 뜻으로는 Yet Another Markup Language가 있다.
기존에 주로 사용되던 포맷인 JSON의 불편함을 해소하기 위해 만들어진 superset으로 properties와 달리 계층 구조
를 잘 나타내고 있으며 동일한 구성이 중복되는 것을 방지
할 수 있다. 이로 인해 가독성
이 크게 향상될 수 있다.
example.jdbc.url=127.0.0.1
example.jdbc.port=3306
example.jdbc.user=user
example.jdbc.password=password
#yaml
example:
jdbc:
url: 127.0.0.1
port: 3306
user: user
password: password
{
"json":[
"rigid",
"better for data interchange"
],
"yaml": [
"slim and flexible",
"better for configuration"
],
"object": {
"key":"value",
"array": [
{
"null_value": null
},
{
"boolean": true
},
{
"integer": 1
}
]
},
"paragraph": "Blank lines denote\nparagraph breaks\n",
"content": "Or we\ncan auto\nconvert line breaks\nto save space"
}
---
# <-yaml supports comments, json does not
# did you know you can embed json in yaml?
# try uncommenting the next line
# { foo: 'bar'}
json:
- rigid
- better for data interchange
yaml:
- slim and flexible
- better for configuration
object:
key: value
array:
- null_value:
- boolean: true
- integer: 1
paragraph: >
Blank lines denote
paragraph breaks
content: |-
Or we
can auto
convert line breaks
to save space
기존json 코드
{
"a": "b"
}
{
"key": "value"
}
yaml으로 바꿨을 때
#!syntax yaml
---
a: b
...
---
key: value
...
json
문서를 그대로 yaml파일로 사용하거나, 원하는 부분만 손볼 수 있다.yaml은 공식 확장자이며 그 외의 확장자로 yml도 사용된다.
옛날에는 파일의 확장자 길이가 3자로 제한되었기 때문에 3글자 확장자 스타일을 고수하는 사람들 때문에 yml파일 확장자가 보이는 것 같다.
개발자로서 성장하는 데 큰 도움이 된 글이었습니다. 감사합니다.