public static <T> void writeListTo(JsonGenerator generator, List<T> messages,
            Schema<T> schema, boolean numeric) throws IOException
    {
        generator.writeStartArray();
        if (messages.isEmpty())
        {
            generator.writeEndArray();
            return;
        }

        final JsonOutput output = new JsonOutput(generator, numeric, schema);

        for (T m : messages)
        {
            generator.writeStartObject();

            schema.writeTo(output, m);
            if (output.isLastRepeated())
                generator.writeEndArray();

            generator.writeEndObject();
            output.reset();
        }

        generator.writeEndArray();
    }
Serializes the {@code messages} into the generator using the given schema.
protostuff-json/src/main/java/io/protostuff/JsonIOUtil.java