public static byte[] toByteArray(Document document) {
        // TODO Vespa 9: change tensorShortForm and tensorDirectValues default to true
        return toByteArray(document, false, false);
    }
Utility method to easily serialize a single document.

@param document the document to be serialized
@return the input document serialised as UTF-8 encoded JSON
document/src/main/java/com/yahoo/document/json/JsonWriter.java