title: Turn pandas columns into JSON string
body: <p>I have a pandas dataframe with columns col1, col2 and col3 and respective values. I would need to transform column names and values into a JSON string.</p>
  <p>For instance, if the dataset is</p>
  <pre><code>data= pd.DataFrame({'col1': ['bravo', 'charlie','price'], 'col2': [1, 2, 3],'col3':['alpha','beta','gamma']})
  </code></pre>
  <p>I need to obtain an output like this</p>
  <pre><code>newdata= pd.DataFrame({'index': [0,1,2], 'payload': ['{&quot;col1&quot;:&quot;bravo&quot;, &quot;col2&quot;:&quot;1&quot;, &quot;col3&quot;:&quot;alpha&quot;}', '{&quot;col1&quot;:&quot;charlie&quot;, &quot;col2&quot;:&quot;2&quot;, &quot;col3&quot;:&quot;beta&quot;}', '{&quot;col1&quot;:&quot;price&quot;, &quot;col2&quot;:&quot;3&quot;, &quot;col3&quot;:&quot;gamma&quot;}']})
  
  I didn't find any function or iterative tool to perform this.
  
  Thank you in advance!
  </code></pre>