code: private static void arrayToWriter(Object array, JsonWriter writer) throws IOException {
      writer.beginArray();
      for (int i = 0, size = Array.getLength(array); i < size; i++) {
        writeValue(Array.get(array, i), writer);
      }
      writer.endArray();
    }
docs: Print the json representation of an array to the given writer. Primitive arrays cannot be cast
  to Object[], to this method accepts the raw object and uses {@link Array#getLength(Object)} and
  {@link Array#get(Object, int)} to read the array.