如何有效保存jsonarray数据?

时间:2019-12-20 02:04:31

标签: json dataset google-places-api

我正在使用google place detail api。
响应值中包含有关营业时间的信息。
信息数据集是JSONARRAY。
我想解析此数据并将其插入数据库,但是我需要有关解析哪些数据集的帮助。 保存数据的目的是用保存的数据确认该场所是否打开。
有以下几种情况。如何有效保存此案?

  

“ day:0” =星期日
  “ day:1” =星期一
  “ day:2” =星期二
  “ day:3” =星期三
  “ day:4” =星期四
  “ day:5” =星期五
  “ day:6” =星期六

case1(存在中断)

    [
        {"close":{"day":1,"time":"1400"},"open":{"day":1,"time":"1200"}},
        {"close":{"day":1,"time":"2000"},"open":{"day":1,"time":"1700"}},
        {"close":{"day":2,"time":"1400"},"open":{"day":2,"time":"1200"}},
        {"close":{"day":2,"time":"2000"},"open":{"day":2,"time":"1700"}},
        {"close":{"day":3,"time":"1400"},"open":{"day":3,"time":"1200"}},
        {"close":{"day":3,"time":"2000"},"open":{"day":3,"time":"1700"}},
        {"close":{"day":4,"time":"1400"},"open":{"day":4,"time":"1200"}},
        {"close":{"day":4,"time":"2000"},"open":{"day":4,"time":"1700"}},
        {"close":{"day":5,"time":"1400"},"open":{"day":5,"time":"1200"}},
        {"close":{"day":5,"time":"2000"},"open":{"day":5,"time":"1700"}},
        {"close":{"day":6,"time":"1400"},"open":{"day":6,"time":"1200"}},
        {"close":{"day":6,"time":"2000"},"open":{"day":6,"time":"1700"}}
    ]

case2(第二天关闭)

    [
        {"close":{"day":1,"time":"0000"},"open":{"day":0,"time":"1130"}},
        {"close":{"day":2,"time":"0300"},"open":{"day":1,"time":"1130"}},
        {"close":{"day":3,"time":"0300"},"open":{"day":2,"time":"1130"}},
        {"close":{"day":4,"time":"0300"},"open":{"day":3,"time":"1130"}},
        {"close":{"day":5,"time":"0300"},"open":{"day":4,"time":"1130"}},
        {"close":{"day":6,"time":"0300"},"open":{"day":5,"time":"1130"}},
        {"close":{"day":0,"time":"0300"},"open":{"day":6,"time":"1130"}}
    ]

case3(正常情况下+第二天关闭)

    [
        {"close":{"day":0,"time":"2200"},"open":{"day":0,"time":"1300"}},
        {"close":{"day":1,"time":"2300"},"open":{"day":1,"time":"1130"}},
        {"close":{"day":2,"time":"2300"},"open":{"day":2,"time":"1130"}},
        {"close":{"day":3,"time":"2300"},"open":{"day":3,"time":"1130"}},
        {"close":{"day":4,"time":"2300"},"open":{"day":4,"time":"1130"}},
        {"close":{"day":6,"time":"0000"},"open":{"day":5,"time":"1130"}},
        {"close":{"day":0,"time":"0000"},"open":{"day":6,"time":"1130"}}
    ]

case4(有些日子休息,有些日子没有休息)

    [
        {"close":{"day":0,"time":"2200"},"open":{"day":0,"time":"1130"}},
        {"close":{"day":1,"time":"1600"},"open":{"day":1,"time":"1130"}},
        {"close":{"day":1,"time":"2200"},"open":{"day":1,"time":"1700"}},
        {"close":{"day":2,"time":"1600"},"open":{"day":2,"time":"1130"}},
        {"close":{"day":2,"time":"2200"},"open":{"day":2,"time":"1700"}},
        {"close":{"day":3,"time":"1600"},"open":{"day":3,"time":"1130"}},
        {"close":{"day":3,"time":"2200"},"open":{"day":3,"time":"1700"}},
        {"close":{"day":4,"time":"1600"},"open":{"day":4,"time":"1130"}},
        {"close":{"day":4,"time":"2200"},"open":{"day":4,"time":"1700"}},
        {"close":{"day":5,"time":"1600"},"open":{"day":5,"time":"1130"}},
        {"close":{"day":5,"time":"2200"},"open":{"day":5,"time":"1700"}},
        {"close":{"day":6,"time":"2200"},"open":{"day":6,"time":"1130"}}
    ]

0 个答案:

没有答案