title: Parsing faulty JSON and be able to display where the error is
body: <p>This is not about how to manage or correct a faulty JSON, it is about how to explain to the user where the error is in the faulty JSON.</p>
  
  <p>Is there a way to find out at which position in the JSON the parser failed.</p>
  
  <p>I want to solve this problem in a node.js application so please keep your answers in that domain if possible.</p>
  
  <p>When I use the built in JSON object and the parse method for a faulty JSON I only get the exception message <strong><code>SyntaxError: Unexpected string</code></strong>. I would like to find out where the error occurred.</p>
  
  <p>Preferred would be a <code>JSON.validate(json)</code> that returned result ok/error and the error position. Something like this:</p>
  
  <pre><code>var faultyJsonToParse = '{"string":"value", "boolean": true"}';
  var result = JSON.validate(faultyJsonToParse);
  if (result.ok == true) {
     console.log('Good JSON, well done!');
  } else {
     console.log('The validator found a \'' + result.error + '\' of type \'' + result.errorType + '\' in your JSON near position ' + result.position);
  }
  </code></pre>
  
  <p>The wanted outcome of the above would be:</p>
  
  <pre><code>The validator found a 'SyntaxError' of type 'Unexpected string' in your JSON near position 35.
  </code></pre>