Trying to do object serialization C++

How this works, first, is how the classes are serialized, For example:

result.push_back(std::make_pair(tileM, strlen(typeM))); // Serializing string
result.push_back(std::make_pair(reinterpret_cast<char*>(&objectNum), sizeof(objectNum))); // Serializing number

It will return a std::vector<std::pair<char*, unsigned long>>, which will be converted to a std::string. And to convert that this script is used:

std::string serialize(Data data) {
    std::vector<std::pair<char*, unsigned long>> semiSerialized = data.serialize();
    std::string buffer = "";
    for (std::pair<char*, unsigned long>& line : semiSerialized) {
        buffer += std::string(line.first) + "," +  std::string(reinterpret_cast<char*>(&line.second)) + "\n";
    }
    return buffer;
}

I’ve created the tests:

#include "data_serializer/include/serialize.hpp"

int main() {
    Data* data = new Data();
    Scene* scene = new Scene();
    data->levels.push_back(*scene);
    std::cout << serialize(*data) << std::endl;
    delete data;
    delete scene; 
}

But it’s just outputting binary mess:

jonas@DESKTOP-7VOL3FE:~/RSGDK$ ./a.out
�,
����,
����,
,
,
,
,
��V,
,
,
,
,
����,
����,