title: PySpark / Python: Transforming dictionary python output into RDD / or other saveable (HDFS) formats
body: <p>I'm new to Spark / Pyspark / HDFS and I'm trying to load a .json-file directly from HDFS with the following code:</p>
  
  <pre><code>import json
  
  file = sc.textFile('/path/to/HDFS/my.json')
  data = file.map(lambda x: json.loads(x))
  lis = data.collect()
  
  ... a lot of Python functions.
  dictionary_output = {'key1': 'value1', 'key2': 'value2', ...}
  </code></pre>
  
  <p>After loading the file, I use some Python functions to process the data. The output after all these functions is dictionary as shown in the code. I now fail to save it back to HDFS as</p>
  
  <pre><code>dictionary_output.saveAsTextFile('/path/')
  </code></pre>
  
  <p>Doesn´t work for dictionaries. I also tried 'parallelizing' the dictionary, but then the output file only contained the key´s and no values.</p>
  
  <p>So my question is: What is the right command to format the dictionary output into a 'RDD' or another file format that can be saved on HDFS with pyspark / python.</p>