title: Google Chart to draw linechart
body: <p>I managed to get dataset for drawing my chart as per my requirement like this:</p>
  
  <p><img src="https://i.stack.imgur.com/N0Dg5.jpg" alt="enter image description here"></p>
  
  <p>Now I want to pass this to my google charts api to draw line chart.</p>
  
  <p>I have done pivoting on my table for getting the desired dataset. Here in this example column1 has months and rest columns are actually from the database(so not sure how many more columns will be there).</p>
  
  <p>I want json string of this format:</p>
  
  <pre><code>"{\"cols\":[
  {\"id\":\"\",\"label\":\"Month\",\"pattern\":\"\",\"type\":\"string\"},
  {\"id\":\"\",\"label\":\"Col1\",\"pattern\":\"\",\"type\":\"number\"},
  {\"id\":\"\",\"label\":\"Col2\",\"pattern\":\"\",\"type\":\"number\"},
  {\"id\":\"\",\"label\":\"Col3\",\"pattern\":\"\",\"type\":\"number\"}
  ],
  \"rows\":[
  {\"c\":[{\"v\":\"Jan\"},{\"v\":37.8},{\"v\":80.8},{\"v\":41.8}]},
  {\"c\":[{\"v\":\"Feb\"},{\"v\":30.9},{\"v\":69.5},{\"v\":32.4}]},
  {\"c\":[{\"v\":\"Mar\"},{\"v\":25.4},{\"v\":57},{\"v\":25.7}]},
  {\"c\":[{\"v\":\"Apr\"},{\"v\":11.7},{\"v\":18.8},{\"v\":10.5}]},
  {\"c\":[{\"v\":\"May\"},{\"v\":11.9},{\"v\":17.6},{\"v\":10.4}]},
  {\"c\":[{\"v\":\"Jun\"},{\"v\":8.8},{\"v\":13.6},{\"v\":7.7}]},
  {\"c\":[{\"v\":\"Jul\"},{\"v\":7.6},{\"v\":12.3},{\"v\":9.6}]},
  {\"c\":[{\"v\":\"Aug\"},{\"v\":12.3},{\"v\":29.2},{\"v\":10.6}]},
  {\"c\":[{\"v\":\"Sep\"},{\"v\":16.9},{\"v\":42.9},{\"v\":14.8}]},
  {\"c\":[{\"v\":\"Oct\"},{\"v\":12.8},{\"v\":30.9},{\"v\":11.6}]},
  {\"c\":[{\"v\":\"Nov\"},{\"v\":5.3},{\"v\":7.9},{\"v\":4.7}]},
  {\"c\":[{\"v\":\"Dec\"},{\"v\":6.6},{\"v\":8.4},{\"v\":5.2}]}]}"
  </code></pre>
  
  <p>How can I form my object class to return this json string? Any ideas would be helpful.</p>
  
  <p>The last option I can think of is building my json string dynamically using stringBuilder. Is there any other way to do this?</p>