Hi:
In apache spark we can read json using the following:
    spark.read.json("path").
There is support to convert json string in a dataframe into structured element 
using 
(https://spark.apache.org/docs/latest/api/java/org/apache/spark/sql/functions.html#from_json-org.apache.spark.sql.Column-org.apache.spark.sql.types.DataType-scala.collection.immutable.Map-)
from_json(<json_string>, schema).
However, is there anyway to convert the row into structured element without the 
schema ?

Also, there is support for getting schema of a json string using schema_of_json
https://spark.apache.org/docs/latest/api/java/org/apache/spark/sql/functions.html#schema_of_json-org.apache.spark.sql.Column-


Is there a way to convert the result into StructType ?
Thanks

Reply via email to