从json文件

时间:2017-03-10 14:08:55

标签: mysql json

我有一个具有以下数据结构的JSON文件:

   [
  {
    "code": "100007", 
    "master": null, 
    "name": "Memphis Hotel Amsterdam", 
    "country": "nl", 
    "zipcode": "1071 NX", 
    "address": "De Lairessestraat 87", 
    "destination": "2078f", 
    "latitude": 52.35352913701477, 
    "longitude": 4.872272238135338, 
    "currencycode": "EUR", 
    "checkin_from": "14:00", 
    "checkout_to": "12:00", 
    "nr_rooms": 78, 
    "stars": 4.0, 
    "hotel_type": "204", 
    "images": [
      {
        "category": "39", 
        "tag": null, 
        "original": "https://d2llb21bdbkhl2.cloudfront.net/1/ace240e96b5b8f54ef19c6467f8e4c92-122903.jpg", 
        "thumbnail_images": {
          "large": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/large/1/ace240e96b5b8f54ef19c6467f8e4c92-122903.jpg", 
          "small": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/small/1/ace240e96b5b8f54ef19c6467f8e4c92-122903.jpg", 
          "mid": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/mid/1/ace240e96b5b8f54ef19c6467f8e4c92-122903.jpg"
        }
      }, 
      {
        "category": null, 
        "tag": null, 
        "original": "https://d2llb21bdbkhl2.cloudfront.net/1/3f8f911b61acb20b1afee88c0a6bc003-122903.jpg", 
        "thumbnail_images": {
          "large": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/large/1/3f8f911b61acb20b1afee88c0a6bc003-122903.jpg", 
          "small": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/small/1/3f8f911b61acb20b1afee88c0a6bc003-122903.jpg", 
          "mid": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/mid/1/3f8f911b61acb20b1afee88c0a6bc003-122903.jpg"
        }
      }, 
      {
        "category": "39", 
        "tag": null, 
        "original": "https://d2llb21bdbkhl2.cloudfront.net/1/58d7f89a4acaa3e55168774a1012732f-122903.jpg", 
        "thumbnail_images": {
          "large": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/large/1/58d7f89a4acaa3e55168774a1012732f-122903.jpg", 
          "small": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/small/1/58d7f89a4acaa3e55168774a1012732f-122903.jpg", 
          "mid": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/mid/1/58d7f89a4acaa3e55168774a1012732f-122903.jpg"
        }
      }, 
      {
        "category": "14", 
        "tag": null, 
        "original": "https://d2llb21bdbkhl2.cloudfront.net/1/5e246b0e1a87298005de3626e04cc0cd-122903.jpg", 
        "thumbnail_images": {
          "large": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/large/1/5e246b0e1a87298005de3626e04cc0cd-122903.jpg", 
          "small": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/small/1/5e246b0e1a87298005de3626e04cc0cd-122903.jpg", 
          "mid": "https://d2llb21bdbkhl2.cloudfront.net/thumbnails/mid/1/5e246b0e1a87298005de3626e04cc0cd-122903.jpg"
        }
      }

    ] 

  }
]  

我可以在图像之前找出所有字段名称表示表格将包含以下字段: 代码,主人,姓名,国家等。但是当我到达图像时它有很多元素。那么我可以将“图像”视为文本类型的字段吗?或者任何人都可以从这个JSON数据建议表结构?

1 个答案:

答案 0 :(得分:0)

您是否考虑使用JSON类型列(5.7版提供)?