vedeli by ste niekto poradit ako parsnut JSON response do spravneho typu ktory je v takomto formate?
{"A":{"hintDiabledDuration":10,"minutesPerLevel":100,"nightPowerUpDuration":12,"timePowerUpAdSeconds":30},"B":{"hintDiabledDuration":10,"minutesPerLevel":100,"nightPowerUpDuration":12,"timePowerUpAdSeconds":30}}
vsetky tie vlastnosti pod A a B mam namapovane do class ConfigVO, ale neviem to spravne parsnut aby tam bolo aj A : ConfigVO aj B: ConfigVO..
Skusal som to cez "root class" ktora by to mala ako List:
[Serializable]
public class HogMuseum
{
public List<ConfigVO> configs = new List<ConfigVO>();
}
a potom :
public void GetConfig()
{
RestClient.Get(DB_URL + ".json").Then((res) =>
{
var remoteConfigs = JsonHelper.FromJsonString<HogMuseum>(res.Text);
}).Catch(err =>
{
Debug.Log("ERROR "+err);
});
}
nefunguje to tak spravne. Ked urobim request iba na samostany JSON obsiahnuty v A alebo B tak to sprane resolvne na ten ConfigVO, ale ako list ci array nie.
Riesili ste to uz niekto?