<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question How to store JSON as TXT file? Please refer screenshot! in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-store-JSON-as-TXT-file-Please-refer-screenshot/m-p/188729#M80423</link>
    <description>&lt;P&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/79429-jsonissue.png"&gt;jsonissue.png&lt;/A&gt; Getting exception that u have multiple columns and text format can accept 1 column only.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Jul 2018 15:11:27 GMT</pubDate>
    <dc:creator>sudhir_reddy</dc:creator>
    <dc:date>2018-07-09T15:11:27Z</dc:date>
    <item>
      <title>How to store JSON as TXT file? Please refer screenshot!</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-store-JSON-as-TXT-file-Please-refer-screenshot/m-p/188729#M80423</link>
      <description>&lt;P&gt;&lt;A href="https://community.cloudera.com/legacyfs/online/attachments/79429-jsonissue.png"&gt;jsonissue.png&lt;/A&gt; Getting exception that u have multiple columns and text format can accept 1 column only.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 15:11:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-store-JSON-as-TXT-file-Please-refer-screenshot/m-p/188729#M80423</guid>
      <dc:creator>sudhir_reddy</dc:creator>
      <dc:date>2018-07-09T15:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to store JSON as TXT file? Please refer screenshot!</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-store-JSON-as-TXT-file-Please-refer-screenshot/m-p/188730#M80424</link>
      <description>&lt;A rel="user" href="https://community.cloudera.com/users/83436/sudhirreddy.html" nodeid="83436"&gt;@sudhir reddy&lt;/A&gt;&lt;P&gt;Try with csv writer as text expects only one column.&lt;/P&gt;&lt;PRE&gt; df.write.mode("overwrite").csv("/user/root/JOUT")&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;(or)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Convert the df to rdd then use saveAsTextFile to write the json to hdfs&lt;/P&gt;&lt;PRE&gt;df.rdd.saveAsTextFile("/user/root/JOUT") &lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;(or)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;using .format("json") and save the file to hdfs&lt;/P&gt;&lt;PRE&gt;df.write.format("json").mode("append").save("/user/root/JOUT")&lt;/PRE&gt;&lt;P&gt;Some useful links regarding similar errors &lt;A href="http://discuss.itversity.com/t/data-frames-writing-it-in-text-format/5146/2" target="_blank"&gt;link1&lt;/A&gt;,&lt;A href="https://stackoverflow.com/questions/44537889/write-store-dataframe-in-text-file" target="_blank"&gt;link2&lt;/A&gt;,&lt;A href="https://forums.databricks.com/questions/11687/how-to-save-a-dataset-as-text.html" target="_blank"&gt;link3&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 16:29:36 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-to-store-JSON-as-TXT-file-Please-refer-screenshot/m-p/188730#M80424</guid>
      <dc:creator>Shu_ashu</dc:creator>
      <dc:date>2018-07-09T16:29:36Z</dc:date>
    </item>
  </channel>
</rss>

