_corrupt_record error when reading a JSON file into Spark

后端 未结 5 2009
清酒与你
清酒与你 2020-12-05 22:57

I\'ve got this JSON file

{
    "a": 1, 
    "b": 2
}

which has been obtained with Python json.dump method. Now, I want to

5条回答
  •  一生所求
    2020-12-05 23:17

    In Spark 2.2+ you can read json file of multiline using following command.

    val dataframe = spark.read.option("multiline",true).json( " filePath ")
    

    if there is json object per line then,

    val dataframe = spark.read.json(filepath)
    

提交回复
热议问题