driver-legacy/src/main/com/mongodb/util/JSON.java
public static String serialize(final Object object) {
        StringBuilder buf = new StringBuilder();
        serialize(object, buf);
        return buf.toString();
    }
public static String serialize(final Object object) {
        StringBuilder buf = new StringBuilder();
        serialize(object, buf);
        return buf.toString();
    }
<p>Serializes an object into its JSON form.</p>

<p>This method delegates serialization to {@code JSONSerializers.getLegacy}</p>

@param object object to serialize
@return String containing JSON form of the object
@see JSONSerializers#getLegacy()