我正在尝试使用以下代码行将此 JSON 数据解析为 R:为什么这不返回任何 JSON?
我得到的错误
fromJSON(file = "http://dcaps-staging.media.mit.edu:8080/api/reality_analysis/get_funf_sensor_data?bearer_token=05abc49652&probe=edu.mit.media.funf.probe.builtin.LocationProbe") 中的错误:意外字符'<'
获取/解析 JSON 的代码
library(RJSONIO)
json=fromJSON(file='http://dcaps-staging.media.mit.edu:8080/api/reality_analysis/get_funf_sensor_data?bearer_token=05abc49652&probe=edu.mit.media.funf.probe.builtin.LocationProbe')
json$result
JSON DATA 托管在其他地方
{"result": [{"TIMESTAMP": 1341888374, "_id": {"$oid": "4ffbc272f679267b6e000002"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.36119137, "mResults": [0.0, 0.0], "mTime": 1341888374725, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 32.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.08727085000001}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341888374, "_id": {"$oid": "4ffbe4faf679261a4a000002"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.36119137, "mResults": [0.0, 0.0], "mTime": 1341888374725, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 32.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.08727085000001}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341908197, "_id": {"$oid": "4ffc00f7f6792624be000003"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.36118479999999, "mResults": [0.0, 0.0], "mTime": 1341908197819, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087435429999999}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341907968, "_id": {"$oid": "4ffc00f8f6792624ba000003"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361219770000005, "mResults": [0.0, 0.0], "mTime": 1341907968890, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087460910000004}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341907518, "_id": {"$oid": "4ffc0105f6792624bb000003"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361184690000002, "mResults": [0.0, 0.0], "mTime": 1341907518554, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087443710000002}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341907563, "_id": {"$oid": "4ffc0107f6792625bc000002"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361189530000004, "mResults": [0.0, 0.0], "mTime": 1341907563782, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087443869999987}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341907609, "_id": {"$oid": "4ffc0107f6792625bc000007"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361184690000002, "mResults": [0.0, 0.0], "mTime": 1341907609009, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087443710000002}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341907657, "_id": {"$oid": "4ffc0107f6792625bc00000a"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361184690000002, "mResults": [0.0, 0.0], "mTime": 1341907657426, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087443710000002}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341908149, "_id": {"$oid": "4ffc015bf6792624ba00000f"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.36118479999999, "mResults": [0.0, 0.0], "mTime": 1341908149220, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087435429999999}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341907792, "_id": {"$oid": "4ffc015ef6792625bb00000c"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361222089999998, "mResults": [0.0, 0.0], "mTime": 1341907792521, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087374009999991}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341907834, "_id": {"$oid": "4ffc015ef6792625bb00000f"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361197509999997, "mResults": [0.0, 0.0], "mTime": 1341907834072, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087434249999987}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341907879, "_id": {"$oid": "4ffc015ef6792625bb000014"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361229649999999, "mResults": [0.0, 0.0], "mTime": 1341907879514, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087405360000005}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341907927, "_id": {"$oid": "4ffc015ef6792625bb00001a"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361229649999999, "mResults": [0.0, 0.0], "mTime": 1341907927603, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087405360000005}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341888374, "_id": {"$oid": "4ffc016ff679263192000002"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.36119137, "mResults": [0.0, 0.0], "mTime": 1341888374725, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 32.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.08727085000001}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341908013, "_id": {"$oid": "4ffc0175f67926256c000022"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361192669999994, "mResults": [0.0, 0.0], "mTime": 1341908013936, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087434090000002}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341908058, "_id": {"$oid": "4ffc0175f67926256c000025"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361204739999991, "mResults": [0.0, 0.0], "mTime": 1341908058976, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087433469999993}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341908104, "_id": {"$oid": "4ffc0175f67926256c00002a"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361204739999991, "mResults": [0.0, 0.0], "mTime": 1341908104005, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087433469999993}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341907026, "_id": {"$oid": "4ffc017bf6792624bc000007"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361204739999991, "mResults": [0.0, 0.0], "mTime": 1341907026801, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087433469999993}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341907068, "_id": {"$oid": "4ffc017bf6792624bc00000b"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361182479999997, "mResults": [0.0, 0.0], "mTime": 1341907068261, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087406810000004}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341906978, "_id": {"$oid": "4ffc017bf67926312c00000b"}, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mProvider": "network", "mLatitude": 42.361204739999991, "mResults": [0.0, 0.0], "mTime": 1341906978288, "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mLon1": 0.0, "mAccuracy": 50.0, "mBearing": 0.0, "mInitialBearing": 0.0, "mHasSpeed": false, "mLon2": 0.0, "mHasBearing": false, "mLongitude": -71.087433469999993}, "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}, {"TIMESTAMP": 1341888328.0, "_id": {"$oid": "5004377f114952a0f6d415c1"}, "SCAN_RESULTS": [{"TIMESTAMP": 1316035121.0, "LOCATION": {"mHasAccuracy": true, "mHasAltitude": false, "mLon2": 0.0, "mLatitude": 42.361263270000009, "mResults": [0.0, 0.0], "mLat1": 0.0, "mDistance": 0.0, "mAltitude": 0.0, "mLat2": 0.0, "mExtras": {"networkLocationType": "wifi", "networkLocationSource": "cached"}, "mSpeed": 0.0, "mInitialBearing": 0.0, "mAccuracy": 52.0, "mBearing": 0.0, "mTime": 1316035121482.0, "mLon1": 0.0, "mHasSpeed": false, "mProvider": "network", "mHasBearing": false, "mLongitude": -71.087640010000001}}], "PROBE": "edu.mit.media.funf.probe.builtin.LocationProbe"}]}
注意 我认为这个问题是由 JSON 引起的。我可以使用上面“获取/解析 JSON 的代码”下列出的相同方法查询其他 JSON 文件,但是当我尝试查询这个特定文件时,我得到了上面的错误......