메인 콘텐츠로 건너뛰기

2026-05-19 · 1분 읽기

config 파일을 위한 YAML과 JSON

runtime이 읽는 format을 고르세요; 양쪽을 모두 통제할 때만 convert하세요.

YAMLJSONconfig

핵심 요점

  • YAML comment과 anchor는 blind JSON round-trip을 survive하지 않습니다.
  • main에 commit하기 전 converted JSON을 validate하세요.

format 선택

comment 있는 hand-edited config에는 YAML; strict parser와 generated artifact에는 JSON.

repo boundary(human YAML → machine JSON)에서 convert하고 매 local save마다 하지 마세요.

안전한 conversion workflow

YAML ⇄ JSON에 paste, diff inspect, 결과에 JSON Validator 실행.

API spec이면 JSON이 OpenAPI document일 때 OpenAPI Validator로 follow-up.

자주 묻는 질문

conversion이 number나 boolean을 바꾸나요?

예 — quotes와 type이 중요합니다. output을 항상 diff하고 CI에서 app parser를 실행하세요.

Kubernetes는 YAML — JSON을 저장해야 하나요?

사람을 위해 git에 YAML; downstream tool이 요구할 때만 JSON generate.