YAML to JSON
tl; dr
- jsonは読めるけど、yamlはまだあまり読めない人が読めるようになる
- vs codeユーザ向け
やり方
では、早速適当なyamlファイルを変換してみましょう
(kubeのdeploymentファイルです)
- 対象のyamlファイルを開いた状態で
- shift + command + P を押す
- 「YAML to JSON:Convert selection or document」と入力
すると以下のようにjsonに変換できます。
jsonが読めて、yamlはまだ苦手という方はこちらを活用してみるのもいいかもしれません。
before
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
after
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "nginx-deployment",
"labels": {
"app": "nginx"
}
},
"spec": {
"replicas": 3,
"selector": {
"matchLabels": {
"app": "nginx"
}
},
"template": {
"metadata": {
"labels": {
"app": "nginx"
}
},
"spec": {
"containers": [
{
"name": "nginx",
"image": "nginx:1.14.2",
"ports": [
{
"containerPort": 80
}
]
}
]
}
}
}
}
Author And Source
この問題について(YAML to JSON), 我々は、より多くの情報をここで見つけました https://qiita.com/lughshot/items/d3ae6223c4471ed73f4c著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .