如何用pandas read_json读取ADSB json数据?

时间:2017-09-23 13:20:19

标签: python json

我想做:

import pandas as pd
df = pd.read_json('2016-06-20-2359Z.json') 

我正在接受这个错误:

ValueError: Trailing data 

以下是json文件的简短版本:

{"src":1,"feeds":[{"id":1,"name":"ADSBexchange.com","polarPlot":false}],"srcFeed":1,"showSil":true,"showFlg":true,"showPic":true,"flgH":20,"flgW":85,"acList":[{"Id":11281748,"Rcvr":1,"HasSig":false,"Icao":"AC2554","Bad":false,"Reg":"N882AS","FSeen":"\/Date(1466467166951)\/","TSecs":3,"CMsgs":1,"AltT":0,"Tisb":false,"TrkH":false,"Type":"CRJ2","Mdl":"2001 BOMBARDIER INC CL-600-2B19","Man":"Bombardier","CNum":"7503","Op":"EXPRESSJET AIRLINES INC     - ATLANTA, GA","OpIcao":"ASQ","Sqk":"","VsiT":0,"WTC":2,"Species":1,"Engines":"2","EngType":3,"EngMount":1,"Mil":false,"Cou":"United States","HasPic":false,"Interested":false,"FlightsCount":0,"Gnd":false,"SpdTyp":0,"CallSus":false,"TT":"a","Trt":1,"Year":"2001"},{"Id":11402205,"Rcvr":1,"HasSig":true,"Sig":110,"Icao":"ADFBDD","Bad":false,"FSeen":"\/Date(1466391940977)\/","TSecs":75229,"CMsgs":35445,"Alt":8025,"GAlt":8025,"AltT":0,"Call":"TEST1234","Tisb":false,"TrkH":false,"Sqk":"0262","Help":false,"VsiT":0,"WTC":0,"Species":0,"EngType":0,"EngMount":0,"Mil":true,"Cou":"United States","HasPic":false,"Interested":false,"FlightsCount":0,"Gnd":true,"SpdTyp":0,"CallSus":false,"TT":"a","Trt":1}],"totalAc":4231,"lastDv":"636019887431643594","shtTrlSec":61,"stm":1466467170029}

有谁能看出原因?

1 个答案:

答案 0 :(得分:0)

如果您的pandas模块是最新的,请使用“lines”参数:

df = pd.read_json('2016-06-20-2359Z.json', lines=True)