Parse JSON root in a column using Spark-Scala
问题 I've problems in order to transform the root of a JSOM a record in a data frame for an undetermined number of records. I've a data frame generated with a JSON similar the following: val exampleJson = spark.createDataset( """ {"ITEM1512": {"name":"Yin", "address":{"city":"Columbus", "state":"Ohio"} }, "ITEM1518": {"name":"Yang", "address":{"city":"Working", "state":"Marc"} } }""" :: Nil) When I read it whit the following instruction val itemsExample = spark.read.json(exampleJson) The Schema