title: Transform JSON-file to table format
body: <p>I have the following JSON file:</p>
  <pre><code>{
    &quot;date&quot;: &quot;2021-07-08&quot;,
    &quot;info&quot;: &quot;success&quot;,
    &quot;data&quot;: [
      {
        &quot;customerid&quot;: &quot;1&quot;,
        &quot;site1&quot;: [&quot;2021-07-08T20:56:16+02:00&quot;]
      },
      {
        &quot;customerid&quot;: &quot;2&quot;,
        &quot;isvip&quot;: true,
        &quot;site1&quot;: [&quot;2021-07-08T18:53:53+02:00&quot;]
      },
      {
        &quot;customerid&quot;: &quot;3&quot;,
        &quot;isvip&quot;: true,
        &quot;site1&quot;: [&quot;2021-07-08T13:29:04+02:00&quot;, &quot;2021-07-08T13:29:02+02:00&quot;],
        &quot;site2&quot;: [ &quot;2021-07-08T05:15:12+02:00&quot;, &quot;2021-07-08T05:15:08+02:00&quot;]
      }
    ]
  }
  </code></pre>
  <p>And I would like to transform it into a SQL table for our database like this:</p>
  <pre><code>| customerid | isvip       | siteid | timestamp           |
  | ---------- | ----------- | ------ | ------------------- |
  | 1          | false       | site1  | 2021-07-08 20:56:16 |
  | 2          | true        | site1  | 2021-07-08 18:53:53 |
  | 3          | true        | site1  | 2021-07-08 13:29:04 |
  | 3          | true        | site1  | 2021-07-08 13:29:02 |
  | 3          | true        | site2  | 2021-07-08 05:15:12 |
  | 3          | true        | site2  | 2021-07-08 05:15:08 |
  </code></pre>
  <p>There are several problems that I have to face:</p>
  <p>1 - I don't care about the date and info in the beginning. They can be eliminated.</p>
  <p>2 - The info about isvip only shows up if the value is true. Otherwise, it's false.</p>
  <p>3 - Several sites can be visited. But they only appear if they actually have been visited. For example, customer 3 is the only one who visited site2.</p>
  <p>4 - (optional) the isvip-field is metadata about the ids which could be put in a separate table. But it's just a binary field, so the use of storage capacity is not a big deal yet.</p>
  <p>I haven't worked with JSON files that much yet.
  I would like to do the code either in SQL or Python (or both).</p>
  <p>Thank you guys for your help!!!</p>