JsonSerializer.SerializeToUtf8Bytes Method (System.Text.Json)
SerializeToUtf8Bytes (Object, Type, JsonSerializerContext) Converts the provided value into a Byte array. SerializeToUtf8Bytes<TValue> (TValue, JsonSerializerOptions) Converts the value of a type specified by a generic type parameter into a JSON string, encoded as UTF-8 bytes.