private byte[] writeDocument(Document doc, boolean tensorShortForm, boolean tensorDirectValues) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        JsonFactory factory = new JsonFactory();
        JsonGenerator generator = factory.createGenerator(out);
        JsonWriter writer = new JsonWriter(generator, tensorShortForm, tensorDirectValues);
        writer.write(doc);
        return out.toByteArray();
    }
Functional tests for com.yahoo.document.json.JsonWriter.

@author Steinar Knutsen
document/src/test/java/com/yahoo/document/json/JsonWriterTestCase.java