将json文件上传到databricks或将其转换为csv

时间:2017-12-03 11:00:25

标签: json csv databricks

我正在尝试将json文件上传到数据块。但数据砖无法识别它。我当时认为首先将json文件转换为csv文件,但我不能这样做。

有人可以帮忙吗?以下是该文件的示例。这很奇怪,因为它没有任何逗号。这些是特定列车乘坐不同站点的延误。此示例对应于特定列车。这个实例的结尾包括火车的id。该文件是几个实例的列表(每个列车一个),如下所示。 非常感谢!! 祝一切顺利 P上。

header {
  gtfs_realtime_version: "1.0"
  incrementality: FULL_DATASET
  timestamp: 1506607201
}
entity {
  id: "0"
  is_deleted: false
  trip_update {
    trip {
      trip_id: ""
      start_date: "20170928"
      schedule_relationship: SCHEDULED
      route_id: "IC3415"
    }
    stop_time_update {
      stop_sequence: 0
      arrival {
        delay: 0
        time: 1506604800
      }
      departure {
        delay: 60
        time: 1506604860
      }
      stop_id: "8882362:3"
    }
    stop_time_update {
      stop_sequence: 1
      arrival {
        delay: 0
        time: 1506605100
      }
      departure {
        delay: 0
        time: 1506605100
      }
      stop_id: "8882339:1"
    }
    stop_time_update {
      stop_sequence: 2
      arrival {
        delay: 60
        time: 1506605580
      }
      departure {
        delay: 0
        time: 1506605640
      }
      stop_id: "8882206:4"
    }
    stop_time_update {
      stop_sequence: 3
      arrival {
        delay: 0
        time: 1506605880
      }
      departure {
        delay: 0
        time: 1506606000
      }
      stop_id: "8882107:3"
    }
    stop_time_update {
      stop_sequence: 4
      arrival {
        delay: 60
        time: 1506606840
      }
      departure {
        delay: 60
        time: 1506606900
      }
      stop_id: "8883212:3"
    }
    stop_time_update {
      stop_sequence: 5
      arrival {
        delay: 0
        time: 1506607260
      }
      departure {
        delay: 0
        time: 1506607380
      }
      stop_id: "8883006:7"
    }
    stop_time_update {
      stop_sequence: 6
      arrival {
        delay: 0
        time: 1506607860
      }
      departure {
        delay: 0
        time: 1506607920
      }
      stop_id: "8883808:1"
    }
    stop_time_update {
      stop_sequence: 7
      arrival {
        delay: 0
        time: 1506608340
      }
      departure {
        delay: 0
        time: 1506608460
      }
      stop_id: "8814308:4"
    }
    stop_time_update {
      stop_sequence: 8
      arrival {
        delay: 0
        time: 1506609000
      }
      departure {
        delay: 0
        time: 1506609240
      }
      stop_id: "8814001:17"
    }
    stop_time_update {
      stop_sequence: 9
      arrival {
        delay: 60
        time: 1506609480
      }
      departure {
        delay: 60
        time: 1506609540
      }
      stop_id: "8813003:5"
    }
    stop_time_update {
      stop_sequence: 10
      arrival {
        delay: 0
        time: 1506609720
      }
      departure {
        delay: 0
        time: 1506609840
      }
      stop_id: "8812005:11"
    }
    stop_time_update {
      stop_sequence: 11
      arrival {
        delay: 0
        time: 1506610380
      }
      departure {
        delay: 0
        time: 1506610440
      }
      stop_id: "8811189:1"
    }
    stop_time_update {
      stop_sequence: 12
      arrival {
        delay: 0
        time: 1506610920
      }
      departure {
        delay: 0
        time: 1506611040
      }
      stop_id: "8822004:7"
    }
    stop_time_update {
      stop_sequence: 13
      arrival {
        delay: 60
        time: 1506612060
      }
      departure {
        delay: 0
        time: 1506612120
      }
      stop_id: "8821600:4"
    }
    stop_time_update {
      stop_sequence: 14
      arrival {
        delay: 0
        time: 1506612960
      }
      departure {
        delay: 0
        time: 1506613080
      }
      stop_id: "8821717:3"
    }
    stop_time_update {
      stop_sequence: 15
      arrival {
        delay: 0
        time: 1506613560
      }
      departure {
        delay: 0
        time: 1506613620
      }
      stop_id: "8821964:2"
    }
    stop_time_update {
      stop_sequence: 16
      arrival {
        delay: 60
        time: 1506614100
      }
      departure {
        delay: 60
        time: 1506614100
      }
      stop_id: "8821907:2"
    }
    vehicle {
      id: "IC3415"
      label: "Binche - Turnhout"
      license_plate: "BE.NMBS.IC3415"
    }
  }
}

0 个答案:

没有答案