docs: function jsonEnd(str, pos) {
    pos = pos | 0;
  
    // Handle the case of a simple literal separately.
    var c = str.charAt(pos++);
    if (/[\d-]/.test(c)) {
      while (/[eE\d.+-]/.test(str.charAt(pos))) {
        pos++;
      }
      return pos;
    } else if (/true|null/.test(str.slice(pos - 1, pos + 3))) {
      return pos + 3;
    } else if (/false/.test(str.slice(pos - 1, pos + 4))) {
      return pos + 4;
    }
  
    // String, object, or array.
    var depth = 0;
    var literal = false;
    do {
      switch (c) {
      case '{':
      case '[':
        if (!literal) { depth++; }
        break;
      case '}':
      case ']':
        if (!literal && !--depth) {
          return pos;
        }
        break;
      case '"':
        literal = !literal;
        if (!depth && !literal) {
          return pos;
        }
        break;
      case '\\':
        pos++; // Skip the next character.
      }
    } while ((c = str.charAt(pos++)));
  
    return -1;
  }