private int findEndBracket(String string) {
        // get starting char
        char begin = string.charAt(0);
        // set ending char we're searching for
        char end;
        switch (begin) {
            case ESCAPE:
                end = ESCAPE;
                break;
            case '{':
                end = '}';
                break;
            case '[':
                end = ']';
                break;
            default:
                // can happen when :null, so return value before comma
                int comma = string.indexOf(',');
                if (comma < 0) {
                    return string.length() - 1;
                } else {
                    return string.indexOf(',') - 1;
                }
        }
        // now walk through while counting the values
        int index = 1;
        int level = 0;
        for (; index < string.length(); index++) {
            char check = string.charAt(index);
            if (level == 0 && check == end) {
                break;
            } else if (check == begin) {
                level++;
            } else if (check == end) {
                level--;
            }
        }
        // System.out.println(string.substring(0, index + 1));
        return index;
    }