title: Spark Dataset with Json output comes out as Kryo encoded
body: <p>I wanted to convert CSV data in a specific JSON format, not the usual flat thing. So I tried the following:</p>
  
  <pre><code>case class CityInfo(lat : Double, long : Double)
    case class City(name: String, country: String, info : CityInfo)
  
  
      implicit def kryoEncoder[A](implicit ct: ClassTag[A]) =
        org.apache.spark.sql.Encoders.[A](ct)
  
      val cities = spark.read.option("header", true).csv("src/main/resources/worldcities.csv").cache()
  
      cities.map {
        case Row(city: String, _: Any, latStr : String, long : String, country: String, _*) =&gt;
          City(city, country, CityInfo(latStr.toDouble, long.toDouble))
      }.write.json("data/testfile.json")
  </code></pre>
  
  <p>From this I would expect json lines with a nested object (like City and CityInfo). But I get lines like:</p>
  
  <p>{"value":"AQBjb20uaGIuZXhlcmNpc2UuU3AxJENpdPkBAUtvc2927wEBY29tLmhiLmV4ZXJjaXNlLlNwMSRDaXR5SW5m7wFARXULDye7MEA0sJAt4A0bAVp1YmluIFBvdG/r"}</p>
  
  <p>I used the Kryo encoder as it was failing to compile, so I found a stack overflow answer about it...not sure it's the right thing.</p>