title: How can I convert a list of map List<Map<String, String>> myList to Spark Dataframe in Java?
body: <p>I have a list of Map like this,</p>
  <pre><code>List&lt;Map&lt;String, Object&gt;&gt; myList = new ArrayList&lt;&gt;();
  
  Map&lt;String, Object&gt; mp1 = new HashMap&lt;&gt;();
  mp1.put(&quot;id&quot;, 1);
  mp1.put(&quot;name&quot;, &quot;John&quot;);
  
  Map&lt;String, Object&gt; mp2 = new HashMap&lt;&gt;();
  mp2.put(&quot;id&quot;, 2);
  mp2.put(&quot;name&quot;, &quot;Carte&quot;);
  </code></pre>
  <p>the <strong>key-value</strong> pairs the we are putting in the map are not fixed, we can have any <strong>dynamic key-value</strong> pairs(dynamic schema).</p>
  <p>I want to convert it into spark dataframe.
  (<strong>Dataset&lt;<strong>Row</strong>&gt;</strong>).</p>
  <p>+--+--------+<br />
  | id    | name   |<br />
  +--+--------+<br />
  | 1 | John  |<br />
  +--+--------+<br />
  | 2 | Carte  |<br />
  +--+--------+</p>
  <p>How this can be achieved ?</p>
  <p><strong>Note:</strong> As I said, the key-value pairs are dynamic, I can not create a java bean in advance and use this below syntax.</p>
  <pre><code>Dataset&lt;Row&gt; ds = spark.createDataFrame(myList, MyClass.class);
  </code></pre>