class JsonWriter {

    public void writeStartObject() throws JsonException {
        writeCurrentKey();
        JsonToken token = stack.peek();
        if (token == null || token == key || token == array) {
            try {
                if (commaFirst) {
                    writer.write(',');
                }
                writer.write('{');
                if (token == key) {
                    stack.pop();
                }
                stack.push(object);
                commaFirst = false;
            } catch (IOException e) {
                throw new JsonException(e.getMessage(), e);
            }
        } else {
            throw new JsonException("Syntax error. Unexpected element '{'.");
        }
    }

    public  JsonWriter(Writer writer);
    public  JsonWriter(OutputStream out);

}