【店小二】公告:

yaml轉json
2156  |   |   |  12

功能介紹

1.在線yaml轉json
2.說明: 由於轉換過程中, yaml 樹的子節點是用 map 保存, 因此在轉 json 後, 得到的結果順序是無序的

示例

apiVersion: v1
kind: Service
metadata:
  name: test-k8s
spec:
  selector:
    app: test-k8s
  type: ClusterIP
  ports:
    - port: 8080        
      targetPort: 8080

處理後

{
    "apiVersion": "v1",
    "kind": "Service",
    "metadata": {
        "name": "test-k8s"
    },
    "spec": {
        "ports": [
            {
                "port": 8080,
                "targetPort": 8080
            }
        ],
        "selector": {
            "app": "test-k8s"
        },
        "type": "ClusterIP"
    }
}