Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
// Depends on jsonlint.js from https://github.com/zaach/jsonlint

CodeMirror.jsonValidator = function(text) {
  var found = [];
  jsonlint.parseError = function(str, hash) {
    var loc = hash.loc;
    found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
                to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
                message: str});
  };
  try { jsonlint.parse(text); }
  catch(e) {}
  return found;
};
New to GrepCode? Check out our FAQ X