code: function removeComments(jsonText) {
          var output = "";
          var scanner = ts.createScanner(1 /* ES5 */, /* skipTrivia */ false, 0 /* Standard */, jsonText);
          var token;
          while ((token = scanner.scan()) !== 1 /* EndOfFileToken */) {
              switch (token) {
                  case 2 /* SingleLineCommentTrivia */:
                  case 3 /* MultiLineCommentTrivia */:
                      // replace comments with whitespace to preserve original character positions
                      output += scanner.getTokenText().replace(/\S/g, " ");
                      break;
                  default:
                      output += scanner.getTokenText();
                      break;
              }
          }
          return output;
      }
docs: Remove the comments from a json like text.
  Comments can be single line comments (starting with # or //) or multiline comments using / * * /
  
  This method replace comment content by whitespace rather than completely remove them to keep positions in json parsing error reporting accurate.