static String toJSONString(Object object, Filter filter, JSONWriter.Feature... features) {
        JSONWriter.Context context = new JSONWriter.Context(JSONFactory.defaultObjectWriterProvider, features);
        try (JSONWriter writer = JSONWriter.of(context)) {
            if (object == null) {
                writer.writeNull();
            } else {
                writer.rootObject = object;
                writer.path = JSONWriter.Path.ROOT;
                if (filter != null) {
                    writer.context.configFilter(filter);
                }

                Class<?> valueClass = object.getClass();
                ObjectWriter<?> objectWriter = context.getObjectWriter(valueClass, valueClass);
                objectWriter.write(writer, object, null, null, 0);
            }
            return writer.toString();
        }
    }
Serializes the specified object to the json string

@param object the specified object will be serialized
@param filter the specified filter is applied to serialization
@param features the specified features is applied to serialization
@return {@link String} that is not null
@throws JSONException If a serialization error occurs
core/src/main/java/com/alibaba/fastjson2/JSON.java