title: spark scala json string to json object customed
body: <p>I have Dataframe with json string column col1 such that this string is built of Maps where most of Maps have same schema but it might be that one of the Maps has got different schema than the others.</p>
  <p>How to parse such json string?</p>
  <ol>
  <li>Should I explode the json string first into separate rows</li>
  <li>Having separate rows should I cast json string to json object using schema condition (how to recognize which map has which schema?)</li>
  </ol>
  <p>How to split such json string into separate rows?</p>
  <p>e.g.</p>
  <p>this is sample value:</p>
  <pre><code>{&quot;protocol&quot;:&quot;xxx&quot;,&quot;start-time&quot;:111,&quot;duration&quot;:0, &quot;foo&quot;:1}
  {&quot;protocol&quot;:&quot;xxx&quot;,&quot;start-time&quot;:111,&quot;duration&quot;:0, &quot;foo&quot;:1}
  {&quot;protocol&quot;:&quot;xxx&quot;,&quot;start-time&quot;:111,&quot;foo&quot;:1}
  {&quot;protocol&quot;:&quot;xxx&quot;,&quot;start-time&quot;:111,&quot;duration&quot;:0, &quot;foo&quot;:1}
  </code></pre>