I would like to read a Json file as Json without parsing. I do not want to use a data frame , I would only like to read it as a regular file with the format still intact. Any idea ? I tried reading using wholtextfile but that creates a df.
Since you didn't accept the spark specific answer maybe you could try with a normal scala solution like this (using the spray-json library):
import spray.json._
val source = scala.io.Source.fromFile("yourFile.txt")
val lines = try source.mkString finally source.close()
val yourJson = lines.parseJson
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With