static String toJSONString(Object object, 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;
                Class<?> valueClass = object.getClass();

                boolean fieldBased = (context.features & JSONWriter.Feature.FieldBased.mask) != 0;
                ObjectWriter<?> objectWriter = context.provider.getObjectWriter(valueClass, valueClass, fieldBased);
                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 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