private SimpleJsonState readJsonObject(SimpleJsonTokenizer x) {
        Map<String, SimpleJsonState> elements = new LinkedHashMap<String, SimpleJsonState>();
        SimpleJsonState res = new SimpleJsonState(elements);

        char c;
        String key;

        if ( x.nextClean() != '{' ) {
            throw x.syntaxError("A JSONObject text must begin with '{'");
        }
        L: for (;;) {
            c = x.nextClean();
            switch (c) {
                case 0:
                    throw x.syntaxError("A JSONObject text must end with '}'");
                case '}':
                    break L;
                default:
                    x.back();
                    key = x.nextValue();
            }

            c = x.nextClean();
            if ( c != ':' ) {
                throw x.syntaxError("Expected a ':' after a key");
            }
            elements.put(key, read(x));

            switch (x.nextClean()) {
                case ';':
                case ',':
                    if ( x.nextClean() == '}' ) {
                        break L;
                    }
                    x.back();
                    break;
                case '}':
                    break L;
                default:
                    throw x.syntaxError("Expected a ',' or '}'");
            }
        }
        return res;
    }