spark toJSON schema code example
Example 1: Read JSON files with automatic schema inference
# Read JSON files with automatic schema inference
df = spark.read.json("logs.json")
df.where("age > 21").select("name.first").show()
Example 2: spark json schema
libraryDependencies += "org.zalando" %% "spark-json-schema" % "0.6.1"