Question by
kristiandgrey · Jun 17, 2021 at 03:52 PM ·
c#serializationjson
wrapping object name around my .FromJson string??
so i have made a json reader and writer here: link text
and this is the result when saving:
{
"playerName": "test6",
"level": 0
}
now i would like to be able to access this bit of data and put it into a class like here:
public static void Login(Client client,string username)
{
print("player " + username + " is logging in...");
//load the save data
PlayerSaveFile save = new PlayerSaveFile(username);
Readable result = save.Find();
PlayerSave FinalSave = (PlayerSave)result.Find(username);
print("FinalSave:" + FinalSave.ToString());
}
this causes an error because i cannot find the username as a field. so i would like to wrap my data that i wrote into the players username, like this:
`playername`{
"playerName": "test6",
"level": 0
}
is there any way to accomplish this? if its confusing i can explain in more detail.
Comment