description: | This is a multi-line string. Each line is preserved exactly. No escaping needed. folded_description: > This is a folded string. These lines will be joined with spaces into one long line.
description: | This is a multi-line string. Each line is preserved exactly. No escaping needed. folded_description: > This is a folded string. These lines will be joined with spaces into one long line.
description: | This is a multi-line string. Each line is preserved exactly. No escaping needed. folded_description: > This is a folded string. These lines will be joined with spaces into one long line.
{ "description": "This is a multi-line string.\nEach line is preserved exactly.\nNo escaping needed."
}
{ "description": "This is a multi-line string.\nEach line is preserved exactly.\nNo escaping needed."
}
{ "description": "This is a multi-line string.\nEach line is preserved exactly.\nNo escaping needed."
}
defaults: &defaults image: node:20-alpine timeout: 300 build: <<: *defaults command: npm run build test: <<: *defaults command: npm test timeout: 600 # Override defaults
defaults: &defaults image: node:20-alpine timeout: 300 build: <<: *defaults command: npm run build test: <<: *defaults command: npm test timeout: 600 # Override defaults
defaults: &defaults image: node:20-alpine timeout: 300 build: <<: *defaults command: npm run build test: <<: *defaults command: npm test timeout: 600 # Override defaults
---
kind: Deployment
metadata: name: my-app
---
kind: Service
metadata: name: my-app-service
---
kind: Deployment
metadata: name: my-app
---
kind: Service
metadata: name: my-app-service
---
kind: Deployment
metadata: name: my-app
---
kind: Service
metadata: name: my-app-service
# These are booleans in YAML 1.1, NOT strings:
enabled: yes # true
disabled: no # false
active: on # true
inactive: off # false
# These are booleans in YAML 1.1, NOT strings:
enabled: yes # true
disabled: no # false
active: on # true
inactive: off # false
# These are booleans in YAML 1.1, NOT strings:
enabled: yes # true
disabled: no # false
active: on # true
inactive: off # false
country: "no" # Norway's country code — NOT a boolean
answer: "yes" # The word "yes" — NOT a boolean
country: "no" # Norway's country code — NOT a boolean
answer: "yes" # The word "yes" — NOT a boolean
country: "no" # Norway's country code — NOT a boolean
answer: "yes" # The word "yes" — NOT a boolean
import yaml, json # JSON to YAML
json_str = '{"name": "Alice", "active": true}'
data = json.loads(json_str)
yaml_str = yaml.dump(data, default_flow_style=False) # YAML to JSON
yaml_str = "name: Alice\nactive: true\n"
data = yaml.safe_load(yaml_str)
json_str = json.dumps(data, indent=2) # File conversion
with open('config.yaml') as f: data = yaml.safe_load(f)
with open('config.json', 'w') as f: json.dump(data, f, indent=2)
import yaml, json # JSON to YAML
json_str = '{"name": "Alice", "active": true}'
data = json.loads(json_str)
yaml_str = yaml.dump(data, default_flow_style=False) # YAML to JSON
yaml_str = "name: Alice\nactive: true\n"
data = yaml.safe_load(yaml_str)
json_str = json.dumps(data, indent=2) # File conversion
with open('config.yaml') as f: data = yaml.safe_load(f)
with open('config.json', 'w') as f: json.dump(data, f, indent=2)
import yaml, json # JSON to YAML
json_str = '{"name": "Alice", "active": true}'
data = json.loads(json_str)
yaml_str = yaml.dump(data, default_flow_style=False) # YAML to JSON
yaml_str = "name: Alice\nactive: true\n"
data = yaml.safe_load(yaml_str)
json_str = json.dumps(data, indent=2) # File conversion
with open('config.yaml') as f: data = yaml.safe_load(f)
with open('config.json', 'w') as f: json.dump(data, f, indent=2)
const yaml = require('js-yaml');
const fs = require('fs'); // YAML to JSON
const yamlContent = fs.readFileSync('config.yaml', 'utf8');
const data = yaml.load(yamlContent);
const jsonContent = JSON.stringify(data, null, 2); // JSON to YAML
const jsonContent2 = fs.readFileSync('config.json', 'utf8');
const data2 = JSON.parse(jsonContent2);
const yamlContent2 = yaml.dump(data2);
const yaml = require('js-yaml');
const fs = require('fs'); // YAML to JSON
const yamlContent = fs.readFileSync('config.yaml', 'utf8');
const data = yaml.load(yamlContent);
const jsonContent = JSON.stringify(data, null, 2); // JSON to YAML
const jsonContent2 = fs.readFileSync('config.json', 'utf8');
const data2 = JSON.parse(jsonContent2);
const yamlContent2 = yaml.dump(data2);
const yaml = require('js-yaml');
const fs = require('fs'); // YAML to JSON
const yamlContent = fs.readFileSync('config.yaml', 'utf8');
const data = yaml.load(yamlContent);
const jsonContent = JSON.stringify(data, null, 2); // JSON to YAML
const jsonContent2 = fs.readFileSync('config.json', 'utf8');
const data2 = JSON.parse(jsonContent2);
const yamlContent2 = yaml.dump(data2);
# Python (no dependencies)
python3 -c "import sys, json, yaml; print(json.dumps(yaml.safe_load(sys.stdin), indent=2))" < config.yaml # Or pipe:
cat config.yaml | python3 -c "import sys, json, yaml; print(json.dumps(yaml.safe_load(sys.stdin), indent=2))" # yq (the jq for YAML — install: pip install yq or brew install yq)
yq -j '.' config.yaml # YAML to JSON
cat data.json | yq -y '.' # JSON to YAML
# Python (no dependencies)
python3 -c "import sys, json, yaml; print(json.dumps(yaml.safe_load(sys.stdin), indent=2))" < config.yaml # Or pipe:
cat config.yaml | python3 -c "import sys, json, yaml; print(json.dumps(yaml.safe_load(sys.stdin), indent=2))" # yq (the jq for YAML — install: pip install yq or brew install yq)
yq -j '.' config.yaml # YAML to JSON
cat data.json | yq -y '.' # JSON to YAML
# Python (no dependencies)
python3 -c "import sys, json, yaml; print(json.dumps(yaml.safe_load(sys.stdin), indent=2))" < config.yaml # Or pipe:
cat config.yaml | python3 -c "import sys, json, yaml; print(json.dumps(yaml.safe_load(sys.stdin), indent=2))" # yq (the jq for YAML — install: pip install yq or brew install yq)
yq -j '.' config.yaml # YAML to JSON
cat data.json | yq -y '.' # JSON to YAML
country_codes: - no # Parses as false (boolean) in YAML 1.1! - gb - us
country_codes: - no # Parses as false (boolean) in YAML 1.1! - gb - us
country_codes: - no # Parses as false (boolean) in YAML 1.1! - gb - us
version: 1.0 # float, not "1.0" string
port: 8080 # integer
hex: 0x1F # integer (31) — if you wanted the string "0x1F", quote it
version: 1.0 # float, not "1.0" string
port: 8080 # integer
hex: 0x1F # integer (31) — if you wanted the string "0x1F", quote it
version: 1.0 # float, not "1.0" string
port: 8080 # integer
hex: 0x1F # integer (31) — if you wanted the string "0x1F", quote it
pip install yamllint
yamllint kubernetes/
pip install yamllint
yamllint kubernetes/
pip install yamllint
yamllint kubernetes/