我的JSON数据有什么问题

时间:2018-03-27 12:46:39

标签: json validation format

我尝试将此文件作为JSON打开,因为它应该是它应该是的,并且因为它有问题。我在网上用json验证器检查了它,根据网站在第70行附近有一个错误。我不是json的专家,所以我不明白它的问题是什么。我复制了它的一小部分,你会在下面找到它。

{
  "status": 200,
  "result": [{
    "postcode": "CF62 4QT",
    "quality": 1,
    "eastings": 302219,
    "northings": 166319,
    "country": "Wales",
    "nhs_ha": "Cardiff and Vale University Health Board",
    "longitude": -3.40660995190364,
    "latitude": 51.3874671892387,
    "european_electoral_region": "Wales",
    "primary_care_trust": "Cardiff and Vale University Health Board",
    "region": null,
    "lsoa": "The Vale of Glamorgan 014E",
    "msoa": "The Vale of Glamorgan 014",
    "incode": "4QT",
    "outcode": "CF62",
    "distance": 0.19425416,
    "parliamentary_constituency": "Vale of Glamorgan",
    "admin_district": "Vale of Glamorgan",
    "parish": "St. Athan",
    "admin_county": null,
    "admin_ward": "St. Athan",
    "ccg": "Cardiff and Vale University Health Board",
    "nuts": "Cardiff and Vale of Glamorgan",
    "codes": {
      "admin_district": "W06000014",
      "admin_county": "W99999999",
      "admin_ward": "W05000649",
      "parish": "W04000668",
      "parliamentary_constituency": "W07000078",
      "ccg": "W11000029",
      "nuts": "UKL22"
    }
  }, {
    "postcode": "CF62 4ZW",
    "quality": 1,
    "eastings": 302219,
    "northings": 166319,
    "country": "Wales",
    "nhs_ha": "Cardiff and Vale University Health Board",
    "longitude": -3.40660995190364,
    "latitude": 51.3874671892387,
    "european_electoral_region": "Wales",
    "primary_care_trust": "Cardiff and Vale University Health Board",
    "region": null,
    "lsoa": "The Vale of Glamorgan 014E",
    "msoa": "The Vale of Glamorgan 014",
    "incode": "4ZW",
    "outcode": "CF62",
    "distance": 0.19425416,
    "parliamentary_constituency": "Vale of Glamorgan",
    "admin_district": "Vale of Glamorgan",
    "parish": "St. Athan",
    "admin_county": null,
    "admin_ward": "St. Athan",
    "ccg": "Cardiff and Vale University Health Board",
    "nuts": "Cardiff and Vale of Glamorgan",
    "codes": {
      "admin_district": "W06000014",
      "admin_county": "W99999999",
      "admin_ward": "W05000649",
      "parish": "W04000668",
      "parliamentary_constituency": "W07000078",
      "ccg": "W11000029",
      "nuts": "UKL22"
    }
},{
  "status": 200,
  "result": [{
    "postcode": "TN31 6QP",
    "quality": 1,
    "eastings": 583576,
    "northings": 125972,
    "country": "England",
    "nhs_ha": "South East Coast",
    "longitude": 0.615129131439058,
    "latitude": 51.0038432751221,
    "european_electoral_region": "South East",
    "primary_care_trust": "Hastings and Rother",
    "region": "South East",
    "lsoa": "Rother 002B",
    "msoa": "Rother 002",
    "incode": "6QP",
    "outcode": "TN31",
    "distance": 2.29609038,
    "parliamentary_constituency": "Bexhill and Battle",
    "admin_district": "Rother",
    "parish": "Northiam",
    "admin_county": "East Sussex",
    "admin_ward": "Rother Levels",
    "ccg": "NHS Hastings and Rother",
    "nuts": "East Sussex CC",
    "codes": {
      "admin_district": "E07000064",
      "admin_county": "E10000011",
      "admin_ward": "E05003977",
      "parish": "E04003815",
      "parliamentary_constituency": "E14000557",
      "ccg": "E38000076",
      "nuts": "UKJ22"
    }

感谢您提供任何帮助。

3 个答案:

答案 0 :(得分:1)

result数组未以]终止。

此外,您返回两个对象而未指定这将是一个数组。

这是固定的JSON:

[
  {
    "status": 200,
    "result": [
      {
        "codes": {
          "nuts": "UKL22",
          "ccg": "W11000029",
          "parliamentary_constituency": "W07000078",
          "parish": "W04000668",
          "admin_ward": "W05000649",
          "admin_county": "W99999999",
          "admin_district": "W06000014"
        },
        "nuts": "Cardiff and Vale of Glamorgan",
        "ccg": "Cardiff and Vale University Health Board",
        "admin_ward": "St. Athan",
        "admin_county": null,
        "parish": "St. Athan",
        "admin_district": "Vale of Glamorgan",
        "parliamentary_constituency": "Vale of Glamorgan",
        "latitude": 51.3874671892387,
        "longitude": -3.40660995190364,
        "nhs_ha": "Cardiff and Vale University Health Board",
        "country": "Wales",
        "northings": 166319,
        "eastings": 302219,
        "quality": 1,
        "postcode": "CF62 4QT",
        "european_electoral_region": "Wales",
        "primary_care_trust": "Cardiff and Vale University Health Board",
        "region": null,
        "lsoa": "The Vale of Glamorgan 014E",
        "msoa": "The Vale of Glamorgan 014",
        "incode": "4QT",
        "outcode": "CF62",
        "distance": 0.19425416
      },
      {
        "codes": {
          "nuts": "UKL22",
          "ccg": "W11000029",
          "parliamentary_constituency": "W07000078",
          "parish": "W04000668",
          "admin_ward": "W05000649",
          "admin_county": "W99999999",
          "admin_district": "W06000014"
        },
        "nuts": "Cardiff and Vale of Glamorgan",
        "ccg": "Cardiff and Vale University Health Board",
        "admin_ward": "St. Athan",
        "admin_county": null,
        "parish": "St. Athan",
        "admin_district": "Vale of Glamorgan",
        "parliamentary_constituency": "Vale of Glamorgan",
        "latitude": 51.3874671892387,
        "longitude": -3.40660995190364,
        "nhs_ha": "Cardiff and Vale University Health Board",
        "country": "Wales",
        "northings": 166319,
        "eastings": 302219,
        "quality": 1,
        "postcode": "CF62 4ZW",
        "european_electoral_region": "Wales",
        "primary_care_trust": "Cardiff and Vale University Health Board",
        "region": null,
        "lsoa": "The Vale of Glamorgan 014E",
        "msoa": "The Vale of Glamorgan 014",
        "incode": "4ZW",
        "outcode": "CF62",
        "distance": 0.19425416
      }
    ]
  },
  {
    "status": 200,
    "result": [
      {
        "codes": {
          "nuts": "UKJ22",
          "ccg": "E38000076",
          "parliamentary_constituency": "E14000557",
          "parish": "E04003815",
          "admin_ward": "E05003977",
          "admin_county": "E10000011",
          "admin_district": "E07000064"
        },
        "nuts": "East Sussex CC",
        "ccg": "NHS Hastings and Rother",
        "admin_ward": "Rother Levels",
        "admin_county": "East Sussex",
        "parish": "Northiam",
        "admin_district": "Rother",
        "parliamentary_constituency": "Bexhill and Battle",
        "latitude": 51.0038432751221,
        "longitude": 0.615129131439058,
        "nhs_ha": "South East Coast",
        "country": "England",
        "northings": 125972,
        "eastings": 583576,
        "quality": 1,
        "postcode": "TN31 6QP",
        "european_electoral_region": "South East",
        "primary_care_trust": "Hastings and Rother",
        "region": "South East",
        "lsoa": "Rother 002B",
        "msoa": "Rother 002",
        "incode": "6QP",
        "outcode": "TN31",
        "distance": 2.29609038
      }
    ]
  }
]

答案 1 :(得分:1)

您的JSON中的result不会关闭

]

请检查result周围的结构,我认为你可以修复它。

答案 2 :(得分:0)

没什么,你最后没有关闭数组和对象,

这是有效数据(已更正)

    {
    "status": 200,
    "result": [
        {
            "postcode": "CF62 4QT",
            "quality": 1,
            "eastings": 302219,
            "northings": 166319,
            "country": "Wales",
            "nhs_ha": "Cardiff and Vale University Health Board",
            "longitude": -3.40660995190364,
            "latitude": 51.3874671892387,
            "european_electoral_region": "Wales",
            "primary_care_trust": "Cardiff and Vale University Health Board",
            "region": null,
            "lsoa": "The Vale of Glamorgan 014E",
            "msoa": "The Vale of Glamorgan 014",
            "incode": "4QT",
            "outcode": "CF62",
            "distance": 0.19425416,
            "parliamentary_constituency": "Vale of Glamorgan",
            "admin_district": "Vale of Glamorgan",
            "parish": "St. Athan",
            "admin_county": null,
            "admin_ward": "St. Athan",
            "ccg": "Cardiff and Vale University Health Board",
            "nuts": "Cardiff and Vale of Glamorgan",
            "codes": {
                "admin_district": "W06000014",
                "admin_county": "W99999999",
                "admin_ward": "W05000649",
                "parish": "W04000668",
                "parliamentary_constituency": "W07000078",
                "ccg": "W11000029",
                "nuts": "UKL22"
            }
        },
        {
            "postcode": "CF62 4ZW",
            "quality": 1,
            "eastings": 302219,
            "northings": 166319,
            "country": "Wales",
            "nhs_ha": "Cardiff and Vale University Health Board",
            "longitude": -3.40660995190364,
            "latitude": 51.3874671892387,
            "european_electoral_region": "Wales",
            "primary_care_trust": "Cardiff and Vale University Health Board",
            "region": null,
            "lsoa": "The Vale of Glamorgan 014E",
            "msoa": "The Vale of Glamorgan 014",
            "incode": "4ZW",
            "outcode": "CF62",
            "distance": 0.19425416,
            "parliamentary_constituency": "Vale of Glamorgan",
            "admin_district": "Vale of Glamorgan",
            "parish": "St. Athan",
            "admin_county": null,
            "admin_ward": "St. Athan",
            "ccg": "Cardiff and Vale University Health Board",
            "nuts": "Cardiff and Vale of Glamorgan",
            "codes": {
                "admin_district": "W06000014",
                "admin_county": "W99999999",
                "admin_ward": "W05000649",
                "parish": "W04000668",
                "parliamentary_constituency": "W07000078",
                "ccg": "W11000029",
                "nuts": "UKL22"
            }
        },
        {
            "status": 200,
            "result": [
                {
                    "postcode": "TN31 6QP",
                    "quality": 1,
                    "eastings": 583576,
                    "northings": 125972,
                    "country": "England",
                    "nhs_ha": "South East Coast",
                    "longitude": 0.615129131439058,
                    "latitude": 51.0038432751221,
                    "european_electoral_region": "South East",
                    "primary_care_trust": "Hastings and Rother",
                    "region": "South East",
                    "lsoa": "Rother 002B",
                    "msoa": "Rother 002",
                    "incode": "6QP",
                    "outcode": "TN31",
                    "distance": 2.29609038,
                    "parliamentary_constituency": "Bexhill and Battle",
                    "admin_district": "Rother",
                    "parish": "Northiam",
                    "admin_county": "East Sussex",
                    "admin_ward": "Rother Levels",
                    "ccg": "NHS Hastings and Rother",
                    "nuts": "East Sussex CC",
                    "codes": {
                        "admin_district": "E07000064",
                        "admin_county": "E10000011",
                        "admin_ward": "E05003977",
                        "parish": "E04003815",
                        "parliamentary_constituency": "E14000557",
                        "ccg": "E38000076",
                        "nuts": "UKJ22"
                    }
                }
            ]
        }
    ]
}