【店小二】公告:

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"
    }
}