<?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 Re: Parse nested json using Spark RDD in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Parse-nested-json-using-Spark-RDD/m-p/324472#M229378</link>
    <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/78612"&gt;@RangaReddy&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The link is exactly what I need. Thanks for your help.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Sep 2021 05:32:01 GMT</pubDate>
    <dc:creator>Seaport</dc:creator>
    <dc:date>2021-09-16T05:32:01Z</dc:date>
    <item>
      <title>Parse nested json using Spark RDD</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Parse-nested-json-using-Spark-RDD/m-p/323975#M229262</link>
      <description>&lt;P&gt;I am trying to parse a nested json document using RDD rather than DataFrame. The reason I cannot use DataFrame (the typical code is like&amp;nbsp;spark.read.json) is that the document structure is very complicated. The schema detected by the reader is useless because child nodes at the same level have different schemas. So I try the script below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import json
s='{"key1":{"myid": "123","myname":"test"}}'
rdd=sc.parallelize(s).map(json.loads)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My next step will be using map transformation to parse json string but I do not know where to start. I tried the script below but it failed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;rdd2=rdd.map(lambda j: (j[x]) for x in j)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any resource on using RDD transformation to parse json.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 08:18:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Parse-nested-json-using-Spark-RDD/m-p/323975#M229262</guid>
      <dc:creator>Seaport</dc:creator>
      <dc:date>2021-09-09T08:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: Parse nested json using Spark RDD</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Parse-nested-json-using-Spark-RDD/m-p/324357#M229344</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/45630"&gt;@Seaport&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please check the following example. It will may help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://kontext.tech/column/spark/284/pyspark-convert-json-string-column-to-array-of-object-structtype-in-data-frame" target="_blank"&gt;https://kontext.tech/column/spark/284/pyspark-convert-json-string-column-to-array-of-object-structtype-in-data-frame&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Sep 2021 05:46:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Parse-nested-json-using-Spark-RDD/m-p/324357#M229344</guid>
      <dc:creator>RangaReddy</dc:creator>
      <dc:date>2021-09-15T05:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: Parse nested json using Spark RDD</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Parse-nested-json-using-Spark-RDD/m-p/324472#M229378</link>
      <description>&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/78612"&gt;@RangaReddy&lt;/a&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The link is exactly what I need. Thanks for your help.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Sep 2021 05:32:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Parse-nested-json-using-Spark-RDD/m-p/324472#M229378</guid>
      <dc:creator>Seaport</dc:creator>
      <dc:date>2021-09-16T05:32:01Z</dc:date>
    </item>
  </channel>
</rss>

