首页 > 解决方案 > 需要帮助修复 homebridge 插件的 JSON

问题描述

需要帮助修复 homebridge 插件的 JSON 语法。我一直在使用 jsonlint,但无法弄清楚如何修复下面的代码,因此语法是正确的。

{
    "bridge": {
        "name": "Homebridge",
        "username": "xxx",
        "port": 51826,
        "pin": "xxx"
    },
    "accessories": [],
    "platforms": [{
                "name": "Config",
                "port": 8080,
                "auth": "form",
                "log": {
                    "method": "file",
                    "path": "/Users/xx/.homebridge/homebridge.log" ["platform": "config"]
                } {
                    "platform": "DysonPlatform",
                    "name": "DysonPlatform",
                    "email": "xxx",
                    "password": "xxx",
                    "country": "US"
                    "accessories": [{
                            "ip": "xxx",
                            "displayName": "Dyson",
                            "serialNumber": "xxx"
             },
        {
          "ip": "ip of your second device",
          "displayName": "Name to be shown on Home App",
          "serialNumber": "DYSON-XXX-XX-XXXXXXXX-XXX",
          "password": "password of your second device"
              }
      ]
    }
  ],

标签: json

解决方案


格式化的 JSON

 {
        "bridge": {
            "name": "Homebridge",
            "username": "xxx",
            "port": 51826,
            "pin": "xxx"
        },
        "accessories": [],
        "platforms": [{
                "name": "Config",
                "port": 8080,
                "auth": "form",
                "log": {
                    "method": "file",
                    "path": "/Users/xx/.homebridge/homebridge.log",
                    "platform": "config"
                }
            },
            {
                "platform": "DysonPlatform",
                "name": "DysonPlatform",
                "email": "xxx",
                "password": "xxx",
                "country": "US",
                "accessories": [{
                    "ip": "xxx",
                    "displayName": "Dyson",
                    "serialNumber": "xxx"
                }, {
                    "ip": "ip of your second device",
                    "displayName": "Name to be shown on Home App",
                    "serialNumber": "DYSON-XXX-XX-XXXXXXXX-XXX",
                    "password": "password of your second device"
                }]
            }
        ]
    }

推荐阅读