title: How to validate json data in javascript
body: <p>Am reading file and storing content  in one variable ie <code>var json</code>.</p>
  
  <p>suppose variable contains like this  </p>
  
  <pre><code>var json = {
      "abc":"abc",
      "xyz":"xyz"
  }
  </code></pre>
  
  <p>Above variable contains valid json.</p>
  
  <p>If there is an error happen in Json file, is there a way to find out where the error is, e.g. line number and column number?</p>
  
  <p>like this  if it is invalid</p>
  
  <pre><code>var json1 = {
  "abc":"abc",
  "xyz":xyz"
  }
  </code></pre>
  
  <p>The error should show like this </p>
  
  <pre><code>Parse error on line 3:
  ...: "abc",    "xyz": xyz"}
  ----------------------^
  </code></pre>