Save GameObject to file without Playerpref

Hi! So I am trying to save everything in my level and with the state they were. EX: If a door was broken, it stays broken. Door was unlocked, it stays unlocked. etc.
.

But All I can find currently find online are lacking a lot of informations and it is really frustrating.
.

I have done multiple test with just the player and I can’t understand why it doesn’t work and what is missing to make it work…
.
I would like to be able to save everything on my player : All its components, all its children and all the childrens’ children (including all their component). In a way, I would sort of think of having the similarity of a prefab of the player for lets say the “save A” or do what unity does when loading a level and remembering exactly where everything was and what were their components etc.
.

Here is a sample of what I tried so far :

using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine;

public static class Load 
{
    //Path of the saves
    static string SavesPath;

     public static GameObject LoadPlayer()
    {
        SavesPath = GameManager.Instance.GetSavesPath;

        if(File.Exists(SavesPath + "/save.json"))
        {
            try
            {
                BinaryFormatter bf = new BinaryFormatter();

                FileStream file = File.Open(SavesPath + "/save.json", FileMode.Open);

                //Get the data
                string data = (string)bf.Deserialize(file);

                //Close the file
                file.Close();

                //Convert the Data into the an Object
                SerializedGameObject player = JsonUtility.FromJson<SerializedGameObject>(data);
                
                Debug.Log(player.gameObject);

                //Return the gameObject
                return player.gameObject;

            }catch(System.Exception e)
            {
                Debug.Log(e);
            }
        }
        return null;
    }
}


public static class Save
{
    //Path of the save
    static string SavesPath;


    /// <summary>
    /// Save instance of the player
    /// </summary>
    public static void Player()
    {

        //Get the save path from the GameManager
        SavesPath = GameManager.Instance.GetSavesPath;

        //Look if the save folder exist
        CheckSaveFolder();

        //Look if the save file exists
        CheckSaveFile();

        try
        {
            //Get the gameobject of the player
            SerializedGameObject player = new SerializedGameObject();
            player.gameObject = PlayerManager.Instance.gameObject;

            //Stringify the GameObject
            string data = JsonUtility.ToJson(player);

            BinaryFormatter bf = new BinaryFormatter();
            FileStream file = File.Open(SavesPath + "/save.json", FileMode.Open);

            bf.Serialize(file,data);
            file.Close();

            Debug.Log("Player saved successfully!");
        }catch(System.Exception e)
        {
            Debug.Log(e);
        }
    }
}

using UnityEngine;

/// <summary>
/// Allow to serialization of a GameObject
/// </summary>

[System.Serializable]
public class SerializedGameObject 
{
    public GameObject gameObject;
}

What you could do instead is have a dictionary of type string,int (or whatever you may need, maybe 0 corresponds to a broken door, 1 to an unlocked one) and have the string correspond to the gameobject name. Then when you reload your scene, just loop through the list to find all your objects and set their individual states. I’m not very well versed on .json files, but you could actually do this with playerPrefs, just do SetInt(objectName , int state)

you use a scriptable object aswell, they story data and retain it.