spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sree Eedupuganti <s...@inndata.in>
Subject How to convert List<Row> into json object / json Array
Date Tue, 30 Aug 2016 08:55:13 GMT
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...



Mime
View raw message