JsonWriter implements Closeable { public ArrayWriter<JsonWriter> writeArray() throws IOException { return new ArrayWriter<JsonWriter>(this, true); } JsonWriter(OutputStream os, Charset charset, ObjectMapper mapper); @Override void close(); JsonWriter flush(); JsonWriter newline(); ObjectWriter<JsonWriter> writeObject(); ArrayWriter<JsonWriter> writeArray();  }
@Test public void writeArray() throws Exception { ByteArrayOutputStream os = new ByteArrayOutputStream(); JsonWriter writer = writer(os); writer.writeArray() .writeString("hello", true) .writeString("world", false) .writeString("again", true) .done() .close(); assertThat(os.toString(charset.name())).isEqualTo("[\"hello\",\"again\"]"); }