Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion to dataframe #318

Open
Avinash2e4e3 opened this issue Mar 28, 2022 · 1 comment
Open

Conversion to dataframe #318

Avinash2e4e3 opened this issue Mar 28, 2022 · 1 comment

Comments

@Avinash2e4e3
Copy link

Hi, How do you convert the resultant json from here back to dataframe using spark scala

@cwgroppe
Copy link

cwgroppe commented Aug 8, 2024

I think it would be something like:

import dijon._
import org.apache.spark.sql.SparkSession

val json: Json[_] = //some Json[_] val
val spark: SparkSession = //some spark session

val jsonAsString = compact(json)
val ds = Seq(jsonAsString).toDS
val df = spark.read.json(ds)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants