2017-03-06 45 views
1

我使用下面的格式從Mongodb中導出了一個JSON文件。我試圖從它創建一個數據框,但我不明白得到tidyjson閱讀它,因爲它會引發此錯誤。R使用tidyjson將JSON文件轉換爲數據框

Error: lexical error: invalid char in json text. 
         {  "_id" : ObjectId("586e684427a06a4a658fa 
        (right here) ------^ 

我用read_json( 「file.json」)

文件低於

{ 
    "_id" : ObjectId("586e684427a06a4a658fa28e"), 
    "expires_in" : ISODate("2016-11-19T22:16:57.418+0000"), 
    "job_type" : "Satellite Sales & Service", 
    "inbound_id" : ObjectId("586e68440c83945fb2658754"), 
    "created_at" : ISODate("2017-01-05T15:37:40.850+0000"), 
    "action_states" : [ 
     { 
      "_id" : ObjectId("586e684627a06a4a658fa293"), 
      "transition_duration" : NumberInt(0), 
      "name" : Symbol("created"), 
      "actor" : "home_owner", 
      "created_at" : ISODate("2017-01-05T15:37:42.297+0000") 
     }, 
     { 
      "_id" : ObjectId("586e68ad0c83945fb2658825"), 
      "transition_duration" : NumberInt(1), 
      "name" : Symbol("accepted"), 
      "reason" : null, 
      "actor" : "contractor", 
      "created_at" : ISODate("2017-01-05T15:39:25.924+0000") 
     } 
    ] 
} 
{ 
    "_id" : ObjectId("586e675d27a06a4a658fa264"), 
    "expires_in" : ISODate("2016-11-19T22:16:57.418+0000"), 
    "job_type" : "Satellite Sales & Service", 
    "inbound_id" : ObjectId("586e675d0c83945fa2f6e190"), 
    "created_at" : ISODate("2017-01-05T15:33:49.934+0000"), 
    "action_states" : [ 
     { 
      "_id" : ObjectId("586e675f27a06a4a658fa267"), 
      "transition_duration" : NumberInt(0), 
      "name" : Symbol("created"), 
      "actor" : "home_owner", 
      "created_at" : ISODate("2017-01-05T15:33:51.097+0000") 
     }, 
     { 
      "_id" : ObjectId("586e694c0c83945faae36559"), 
      "transition_duration" : NumberInt(8), 
      "name" : Symbol("accepted"), 
      "reason" : null, 
      "actor" : "contractor", 
      "created_at" : ISODate("2017-01-05T15:42:04.116+0000") 
     } 
    ] 
} 

回答