title: Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>)
body: <p>I need some help with this error:</p>
  <blockquote>
  <p>Uncaught SyntaxError: Unexpected end of JSON input
  at JSON.parse ()
  at Object.success (dashboard.js:22)
  at fire (jquery-3.3.1.js:3268)
  at Object.fireWith [as resolveWith] (jquery-3.3.1.js:3398)
  at done (jquery-3.3.1.js:9305)
  at XMLHttpRequest. (jquery-3.3.1.js:9548)</p>
  </blockquote>
  <p>I try to transform a string to a json object using <em>JSON.parse()</em> that cause that error.
  I am using oracleJet and this is my code:</p>
  <pre><code>function DashboardViewModel() {
    
      var self = this;
      self.lineTypeValue = ko.observable('curved');
      var scatterSeries = []; 
      
      $.getJSON( &quot;http://localhost:8080/points&quot;, function (data) {
                 console.info(data);
                 var ch = '{&quot;name&quot;:&quot;graphe1&quot;,&quot;items&quot;:'+JSON.stringify(data.results[1])+ '}';
                 console.info(ch);
                 console.info(JSON.parse(scatterSeries));
                 scatterSeries.push(JSON.parse(ch));
                 
          });
      
      
      /* chart data */
      
      this.scatterSeriesValue = ko.observableArray(scatterSeries);
      
      self.lineTypeOptions = [
          {id: 'straight', label: 'straight'},
          {id: 'curved', label: 'curved'},
          {id: 'stepped', label: 'stepped'},
          {id: 'segmented', label: 'segmented'},
          {id: 'none', label: 'none'}
      ];
    
    
  }
  </code></pre>
  <p>The Json that I get from <em>&quot;http://localhost:8080/points&quot;</em> look like this:</p>
  <pre><code>{ &quot;results&quot;:[  
    [  
       {  
          &quot;b&quot;:&quot;0.110547334&quot;,
          &quot;cost&quot;:&quot;0.000000&quot;,
          &quot;w&quot;:&quot;1.998889&quot;
       }
    ],
    [  
       {  
          &quot;x&quot;:0,
          &quot;y&quot;:0
       },
       {  
          &quot;x&quot;:1,
          &quot;y&quot;:2
       },
       {  
          &quot;x&quot;:2,
          &quot;y&quot;:4
       },
       {  
          &quot;x&quot;:3,
          &quot;y&quot;:6
       },
       {  
          &quot;x&quot;:4,
          &quot;y&quot;:8
       },
       {  
          &quot;x&quot;:5,
          &quot;y&quot;:10
       },
       {  
          &quot;x&quot;:6,
          &quot;y&quot;:12
       },
       {  
          &quot;x&quot;:7,
          &quot;y&quot;:14
       },
       {  
          &quot;x&quot;:8,
          &quot;y&quot;:16
       },
       {  
          &quot;x&quot;:9,
          &quot;y&quot;:18
       },
       {  
          &quot;x&quot;:10,
          &quot;y&quot;:20
       },
       {  
          &quot;x&quot;:11,
          &quot;y&quot;:22
       },
       {  
          &quot;x&quot;:12,
          &quot;y&quot;:24
       },
       {  
          &quot;x&quot;:13,
          &quot;y&quot;:26
       },
       {  
          &quot;x&quot;:14,
          &quot;y&quot;:28
       },
       {  
          &quot;x&quot;:15,
          &quot;y&quot;:30
       },
       {  
          &quot;x&quot;:16,
          &quot;y&quot;:32
       },
       {  
          &quot;x&quot;:17,
          &quot;y&quot;:34
       },
       {  
          &quot;x&quot;:18,
          &quot;y&quot;:36
       },
       {  
          &quot;x&quot;:19,
          &quot;y&quot;:38
       },
       {  
          &quot;x&quot;:20,
          &quot;y&quot;:40
       },
       {  
          &quot;x&quot;:21,
          &quot;y&quot;:42
       },
       {  
          &quot;x&quot;:22,
          &quot;y&quot;:44
       },
       {  
          &quot;x&quot;:23,
          &quot;y&quot;:46
       },
       {  
          &quot;x&quot;:24,
          &quot;y&quot;:48
       },
       {  
          &quot;x&quot;:25,
          &quot;y&quot;:50
       },
       {  
          &quot;x&quot;:26,
          &quot;y&quot;:52
       },
       {  
          &quot;x&quot;:27,
          &quot;y&quot;:54
       },
       {  
          &quot;x&quot;:28,
          &quot;y&quot;:56
       },
       {  
          &quot;x&quot;:29,
          &quot;y&quot;:58
       },
       {  
          &quot;x&quot;:30,
          &quot;y&quot;:60
       },
       {  
          &quot;x&quot;:31,
          &quot;y&quot;:62
       },
       {  
          &quot;x&quot;:32,
          &quot;y&quot;:64
       },
       {  
          &quot;x&quot;:33,
          &quot;y&quot;:66
       },
       {  
          &quot;x&quot;:34,
          &quot;y&quot;:68
       },
       {  
          &quot;x&quot;:35,
          &quot;y&quot;:70
       },
       {  
          &quot;x&quot;:36,
          &quot;y&quot;:72
       },
       {  
          &quot;x&quot;:37,
          &quot;y&quot;:74
       },
       {  
          &quot;x&quot;:38,
          &quot;y&quot;:76
       },
       {  
          &quot;x&quot;:39,
          &quot;y&quot;:78
       },
       {  
          &quot;x&quot;:40,
          &quot;y&quot;:80
       },
       {  
          &quot;x&quot;:41,
          &quot;y&quot;:82
       },
       {  
          &quot;x&quot;:42,
          &quot;y&quot;:84
       },
       {  
          &quot;x&quot;:43,
          &quot;y&quot;:86
       },
       {  
          &quot;x&quot;:44,
          &quot;y&quot;:88
       },
       {  
          &quot;x&quot;:45,
          &quot;y&quot;:90
       },
       {  
          &quot;x&quot;:46,
          &quot;y&quot;:92
       },
       {  
          &quot;x&quot;:47,
          &quot;y&quot;:94
       },
       {  
          &quot;x&quot;:48,
          &quot;y&quot;:96
       },
       {  
          &quot;x&quot;:49,
          &quot;y&quot;:98
       },
       {  
          &quot;x&quot;:50,
          &quot;y&quot;:100
       },
       {  
          &quot;x&quot;:51,
          &quot;y&quot;:102
       },
       {  
          &quot;x&quot;:52,
          &quot;y&quot;:104
       },
       {  
          &quot;x&quot;:53,
          &quot;y&quot;:106
       },
       {  
          &quot;x&quot;:54,
          &quot;y&quot;:108
       },
       {  
          &quot;x&quot;:55,
          &quot;y&quot;:110
       },
       {  
          &quot;x&quot;:56,
          &quot;y&quot;:112
       },
       {  
          &quot;x&quot;:57,
          &quot;y&quot;:114
       },
       {  
          &quot;x&quot;:58,
          &quot;y&quot;:116
       },
       {  
          &quot;x&quot;:59,
          &quot;y&quot;:118
       },
       {  
          &quot;x&quot;:60,
          &quot;y&quot;:120
       },
       {  
          &quot;x&quot;:61,
          &quot;y&quot;:122
       },
       {  
          &quot;x&quot;:62,
          &quot;y&quot;:124
       },
       {  
          &quot;x&quot;:63,
          &quot;y&quot;:126
       },
       {  
          &quot;x&quot;:64,
          &quot;y&quot;:128
       },
       {  
          &quot;x&quot;:65,
          &quot;y&quot;:130
       },
       {  
          &quot;x&quot;:66,
          &quot;y&quot;:132
       },
       {  
          &quot;x&quot;:67,
          &quot;y&quot;:134
       },
       {  
          &quot;x&quot;:68,
          &quot;y&quot;:136
       },
       {  
          &quot;x&quot;:69,
          &quot;y&quot;:138
       },
       {  
          &quot;x&quot;:70,
          &quot;y&quot;:140
       },
       {  
          &quot;x&quot;:71,
          &quot;y&quot;:142
       },
       {  
          &quot;x&quot;:72,
          &quot;y&quot;:144
       },
       {  
          &quot;x&quot;:73,
          &quot;y&quot;:146
       },
       {  
          &quot;x&quot;:74,
          &quot;y&quot;:148
       },
       {  
          &quot;x&quot;:75,
          &quot;y&quot;:150
       },
       {  
          &quot;x&quot;:76,
          &quot;y&quot;:152
       },
       {  
          &quot;x&quot;:77,
          &quot;y&quot;:154
       },
       {  
          &quot;x&quot;:78,
          &quot;y&quot;:156
       },
       {  
          &quot;x&quot;:79,
          &quot;y&quot;:158
       },
       {  
          &quot;x&quot;:80,
          &quot;y&quot;:160
       },
       {  
          &quot;x&quot;:81,
          &quot;y&quot;:162
       },
       {  
          &quot;x&quot;:82,
          &quot;y&quot;:164
       },
       {  
          &quot;x&quot;:83,
          &quot;y&quot;:166
       },
       {  
          &quot;x&quot;:84,
          &quot;y&quot;:168
       },
       {  
          &quot;x&quot;:85,
          &quot;y&quot;:170
       },
       {  
          &quot;x&quot;:86,
          &quot;y&quot;:172
       },
       {  
          &quot;x&quot;:87,
          &quot;y&quot;:174
       },
       {  
          &quot;x&quot;:88,
          &quot;y&quot;:176
       },
       {  
          &quot;x&quot;:89,
          &quot;y&quot;:178
       },
       {  
          &quot;x&quot;:90,
          &quot;y&quot;:180
       },
       {  
          &quot;x&quot;:91,
          &quot;y&quot;:182
       },
       {  
          &quot;x&quot;:92,
          &quot;y&quot;:184
       },
       {  
          &quot;x&quot;:93,
          &quot;y&quot;:186
       },
       {  
          &quot;x&quot;:94,
          &quot;y&quot;:188
       },
       {  
          &quot;x&quot;:95,
          &quot;y&quot;:190
       },
       {  
          &quot;x&quot;:96,
          &quot;y&quot;:192
       },
       {  
          &quot;x&quot;:97,
          &quot;y&quot;:194
       },
       {  
          &quot;x&quot;:98,
          &quot;y&quot;:196
       },
       {  
          &quot;x&quot;:99,
          &quot;y&quot;:198
       }
    ]]}
  </code></pre>
  <p>and what I want the variable <em><strong>scatterSeries</strong></em> to hold is a table like this one:</p>
  <pre><code>[  {  
    name:&quot;graphe1&quot;,
    items:[  
       {  
          x:8,
          y:2
       },
       {  
          x:15,
          y:15
       },
       {  
          x:25,
          y:26
       },
       {  
          x:33,
          y:22
       },
       {  
          x:36,
          y:40
       }
    ]},]
  </code></pre>
  <p>what I get in the console about the string <em><strong>ch</strong></em> is this:</p>
  <pre><code>{&quot;name&quot;:&quot;graphe1&quot;,&quot;items&quot;:[{&quot;x&quot;:0,&quot;y&quot;:0},{&quot;x&quot;:1,&quot;y&quot;:2},{&quot;x&quot;:2,&quot;y&quot;:4},{&quot;x&quot;:3,&quot;y&quot;:6},{&quot;x&quot;:4,&quot;y&quot;:8},{&quot;x&quot;:5,&quot;y&quot;:10},{&quot;x&quot;:6,&quot;y&quot;:12},{&quot;x&quot;:7,&quot;y&quot;:14},{&quot;x&quot;:8,&quot;y&quot;:16},{&quot;x&quot;:9,&quot;y&quot;:18},{&quot;x&quot;:10,&quot;y&quot;:20},{&quot;x&quot;:11,&quot;y&quot;:22},{&quot;x&quot;:12,&quot;y&quot;:24},{&quot;x&quot;:13,&quot;y&quot;:26},{&quot;x&quot;:14,&quot;y&quot;:28},{&quot;x&quot;:15,&quot;y&quot;:30},{&quot;x&quot;:16,&quot;y&quot;:32},{&quot;x&quot;:17,&quot;y&quot;:34},{&quot;x&quot;:18,&quot;y&quot;:36},{&quot;x&quot;:19,&quot;y&quot;:38},{&quot;x&quot;:20,&quot;y&quot;:40},{&quot;x&quot;:21,&quot;y&quot;:42},{&quot;x&quot;:22,&quot;y&quot;:44},{&quot;x&quot;:23,&quot;y&quot;:46},{&quot;x&quot;:24,&quot;y&quot;:48},{&quot;x&quot;:25,&quot;y&quot;:50},{&quot;x&quot;:26,&quot;y&quot;:52},{&quot;x&quot;:27,&quot;y&quot;:54},{&quot;x&quot;:28,&quot;y&quot;:56},{&quot;x&quot;:29,&quot;y&quot;:58},{&quot;x&quot;:30,&quot;y&quot;:60},{&quot;x&quot;:31,&quot;y&quot;:62},{&quot;x&quot;:32,&quot;y&quot;:64},{&quot;x&quot;:33,&quot;y&quot;:66},{&quot;x&quot;:34,&quot;y&quot;:68},{&quot;x&quot;:35,&quot;y&quot;:70},{&quot;x&quot;:36,&quot;y&quot;:72},{&quot;x&quot;:37,&quot;y&quot;:74},{&quot;x&quot;:38,&quot;y&quot;:76},{&quot;x&quot;:39,&quot;y&quot;:78},{&quot;x&quot;:40,&quot;y&quot;:80},{&quot;x&quot;:41,&quot;y&quot;:82},{&quot;x&quot;:42,&quot;y&quot;:84},{&quot;x&quot;:43,&quot;y&quot;:86},{&quot;x&quot;:44,&quot;y&quot;:88},{&quot;x&quot;:45,&quot;y&quot;:90},{&quot;x&quot;:46,&quot;y&quot;:92},{&quot;x&quot;:47,&quot;y&quot;:94},{&quot;x&quot;:48,&quot;y&quot;:96},{&quot;x&quot;:49,&quot;y&quot;:98},{&quot;x&quot;:50,&quot;y&quot;:100},{&quot;x&quot;:51,&quot;y&quot;:102},{&quot;x&quot;:52,&quot;y&quot;:104},{&quot;x&quot;:53,&quot;y&quot;:106},{&quot;x&quot;:54,&quot;y&quot;:108},{&quot;x&quot;:55,&quot;y&quot;:110},{&quot;x&quot;:56,&quot;y&quot;:112},{&quot;x&quot;:57,&quot;y&quot;:114},{&quot;x&quot;:58,&quot;y&quot;:116},{&quot;x&quot;:59,&quot;y&quot;:118},{&quot;x&quot;:60,&quot;y&quot;:120},{&quot;x&quot;:61,&quot;y&quot;:122},{&quot;x&quot;:62,&quot;y&quot;:124},{&quot;x&quot;:63,&quot;y&quot;:126},{&quot;x&quot;:64,&quot;y&quot;:128},{&quot;x&quot;:65,&quot;y&quot;:130},{&quot;x&quot;:66,&quot;y&quot;:132},{&quot;x&quot;:67,&quot;y&quot;:134},{&quot;x&quot;:68,&quot;y&quot;:136},{&quot;x&quot;:69,&quot;y&quot;:138},{&quot;x&quot;:70,&quot;y&quot;:140},{&quot;x&quot;:71,&quot;y&quot;:142},{&quot;x&quot;:72,&quot;y&quot;:144},{&quot;x&quot;:73,&quot;y&quot;:146},{&quot;x&quot;:74,&quot;y&quot;:148},{&quot;x&quot;:75,&quot;y&quot;:150},{&quot;x&quot;:76,&quot;y&quot;:152},{&quot;x&quot;:77,&quot;y&quot;:154},{&quot;x&quot;:78,&quot;y&quot;:156},{&quot;x&quot;:79,&quot;y&quot;:158},{&quot;x&quot;:80,&quot;y&quot;:160},{&quot;x&quot;:81,&quot;y&quot;:162},{&quot;x&quot;:82,&quot;y&quot;:164},{&quot;x&quot;:83,&quot;y&quot;:166},{&quot;x&quot;:84,&quot;y&quot;:168},{&quot;x&quot;:85,&quot;y&quot;:170},{&quot;x&quot;:86,&quot;y&quot;:172},{&quot;x&quot;:87,&quot;y&quot;:174},{&quot;x&quot;:88,&quot;y&quot;:176},{&quot;x&quot;:89,&quot;y&quot;:178},{&quot;x&quot;:90,&quot;y&quot;:180},{&quot;x&quot;:91,&quot;y&quot;:182},{&quot;x&quot;:92,&quot;y&quot;:184},{&quot;x&quot;:93,&quot;y&quot;:186},{&quot;x&quot;:94,&quot;y&quot;:188},{&quot;x&quot;:95,&quot;y&quot;:190},{&quot;x&quot;:96,&quot;y&quot;:192},{&quot;x&quot;:97,&quot;y&quot;:194},{&quot;x&quot;:98,&quot;y&quot;:196},{&quot;x&quot;:99,&quot;y&quot;:198}]}
  </code></pre>
  <p>Any help please?!! :( :(</p>