Utilizing Unity's default serializer

Is it possible to somehow manually call Unity’s default serializer?

I would need something similar to this:

var toSerialize = new Something { X = 3 };
var serializationTarget = File.Open("<path>"); // or something similar

UnitySerializer.Serialize(toSerialize, serializationTarget);

So basically I want to explicitly trigger serialization and also define where the serialized output goes.

Is this possible?

This is what you need

Apparently Unity’s default serializer is written in C++ and is not meant to be accessible by scripts.

I started a feedback item to maybe remedy this issue here.