title: SyntaxError: JSON.parse: unexpected end of data
body: <p>I keep getting this SyntaxError when reading json parameters from a rest api in javascript. </p>
  
  <p>Any clue what it might be?</p>
  
  <p>I appreciate any help</p>
  
  <p>code:</p>
  
  <pre><code>     parseJSONResponse : function(inResult) {
       var jsonDoc = JSON.parse(inResult);
  
      this.fmeForm =  document.forms['fmeForm'];
  
      ar parameters = jsonDoc.serviceResponse.parameters.parameter;
      for( i = 0; i &lt; parameters.length; i++) {
  
          if(parameters[i].type === "LOOKUP_CHOICE") {
              this.createComboBox(parameters);
          }
          if(parameters[i].type === "LISTBOX_ENCODED") {
              this.createCheckboxGroup(parameters);
          }
      }
  },
  </code></pre>
  
  <p>And the json from a rest look like this:</p>
  
  <pre><code>      "serviceResponse": {
        "parameters": {"parameter": [
    {
       "optionsType": "MULTICHOICE_CONFIG",
       "type": "LISTBOX_ENCODED",
       "options": {"option": [
          {"value": "NOR"},
          {"value": "NOR_roads"}
       ]}
    },
    {
       "optionsType": "SINGLECHOICE_CONFIG",
       "type": "LOOKUP_CHOICE",
       "options": {"option": [
          {
             "displayAlias": "WGS84, Lat-Long; Degrees [LL84]",
             "value": "EPSG:4326"
          }
       ]}
    },
    {
       "name": "GEOM",
       "description": "",
       "defaultValue": "&lt;lt&gt;?xml&lt;space&gt;version=&lt;quote&gt;1.0&lt;quote&gt;&lt;space&gt;encoding=     &lt;quote&gt;US_ASCII&lt;quote&gt;&lt;space&gt;standalone=&lt;quote&gt;no&lt;quote&gt;&lt;space&gt;?&lt;gt&gt;&lt;lt&gt;geometry&lt;gt&gt;  &lt;lt&gt;polygon&lt;gt&gt;&lt;lt&gt;line&lt;gt&gt;&lt;lt&gt;coord&lt;space&gt;x=&lt;quote&gt;-124&lt;quote&gt;&lt;space&gt;y=&lt;quote&gt;48&lt;quote&gt;&lt;solidus&gt;&lt;gt&gt;&lt;lt&gt;coord&lt;space&gt;x=&lt;quote&gt;-124&lt;quote&gt;&lt;space&gt;y=&lt;quote&gt;49.399999999999999&lt;quote&gt;&lt;solidus&gt;&lt;gt&gt;&lt;lt&gt;&lt;solidus&gt;line&lt;gt&gt;&lt;lt&gt;&lt;solidus&gt;polygon&lt;gt&gt;&lt;lt&gt;&lt;solidus&gt;geometry&lt;gt&gt;",
       "optionsType": "SINGLECHOICE_CONFIG",
       "type": "GEOMETRY",
       "options": {"option": {"value": "GEOM"}}
    },
  </code></pre>
  
  <p>Thanx!</p>