title: create javascript array in json response in Java
body: <p>I have a servlet where I send JSON response (back to javascript) . For example , my response looks like </p>
  
  <pre><code>{
      "responseStr":"1,5,119.8406677,7,7,116.5664291,10,10,116.6099319,20,10,117.2185898,25,3,115.2636185"
  }
  </code></pre>
  
  <p>Now what is happening at the moment is that I am collecting data( numbers above) in servlet and sending it in JSON response as a String with comma separated values. When this response reaches front end, all these numbers have to go in a javascript array (where I do my further logic). Currently I am doing this by </p>
  
  <pre><code>var res = JSON.parse(REQ.responseText);         
  var myArr = res.responseStr.split(',');
  </code></pre>
  
  <p>My thinking is that the second line( where I use split()) is causing a bottleneck in my application . A few data points as in above example are not a trouble but it becomes a problem when i have thousands of data points.</p>
  
  <p>So my question is that is there a way that when I am creating my response in servlet that I can  create the response as javascript array so that I do not have to use split() at all?
  Any better ways of achieving the above task of converting the response into javascript array?</p>