Here is the snippet of my code :
Dataset<Row> rows_salaries = spark.read().json("/Users/Macbook/Downloads/rows_salaries.json");
rows_salaries.createOrReplaceTempView("salaries");
List<Row> df = spark.sql("select * from salaries").collectAsList();
I need to read the json data from 'List<Row> df = spark.sql("select * from salaries").collectAsList();'
but i am unable to convert 'df' to either JSONObject or JSONArray. Is the way am i going
is right or any other way to fetch the JSON data. Any suggestions please...
Thanks...
|