Created
August 12, 2016 20:46
-
-
Save azampagl/36a69b1bf8503764197dc9e24529448f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data = [{'id': 1, 'value': "{name: 'Aaron', 'Coolness': 10}"}, {'id': 2, 'value': "{name: 'Fil', 'Coolness': 10}"}] | |
df = sqlContext.createDataFrame(data) | |
# print df.rdd.collectAsMap() | |
import json | |
with open('/tmp/myoutput.json', 'w') as outfile: | |
json.dump(df.rdd.collectAsMap(), outfile) | |
# display(dbutils.fs.ls("file:/tmp/myoutput.json")) | |
dbutils.fs.mkdirs("/FileStore/4thera") | |
dbutils.fs.cp("file:/tmp/myoutput.json", "/FileStore/4thera/myoutput.json") | |
# Go to https://community.cloud.databricks.com/files/4thera/myoutput.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment