✅ JsonConvert.DeserializeObject return contains all null elements
Using
However, the deserializer is not throwing an error but every element of
https://cdn.discordapp.com/attachments/1177777512525340752/1179410186717364324/image.png?ex=6579ae54&is=65673954&hm=c0ab82bfb39fd7785f407e64f07aaba100ba3cad3f1326bf4a59fb3b4a3935f4&
Newtonsoft.JsonNewtonsoft.Json, I have the following JSON (attached) with the following deserializer code: public class ObjectDB
{
public struct DBFile
{
long Timestamp;
List<Class> Classes;
List<Object> Objects;
List<Category> Categories;
}
struct Class
{
string InternalName;
string Name;
string Notes;
int Games;
int Progress;
Dictionary<string, Parameter> Parameters;
}
struct ArgValue
{
string Value;
string Notes;
}
struct Object
{
string InternalName;
string ClassNameSMG1;
string ClassNameSMG2;
string Name;
string Notes;
string Category;
string AreaShape;
string ListSMG1;
string ListSMG2;
string File;
int Games;
int Progress;
bool IsUnused;
bool IsLeftover;
}
struct Category
{
string Key;
string Description;
}
struct Parameter
{
string Name;
string Type;
int Games;
bool Needed;
string Description;
List<ArgValue> Values;
List<string> Exclusives;
}
public static void LoadDB()
{
JsonSerializerSettings settings = new();
sDatabase = JsonConvert.DeserializeObject<DBFile>(File.ReadAllText("res/objectdb.json"), settings);
}
static DBFile sDatabase;
} public class ObjectDB
{
public struct DBFile
{
long Timestamp;
List<Class> Classes;
List<Object> Objects;
List<Category> Categories;
}
struct Class
{
string InternalName;
string Name;
string Notes;
int Games;
int Progress;
Dictionary<string, Parameter> Parameters;
}
struct ArgValue
{
string Value;
string Notes;
}
struct Object
{
string InternalName;
string ClassNameSMG1;
string ClassNameSMG2;
string Name;
string Notes;
string Category;
string AreaShape;
string ListSMG1;
string ListSMG2;
string File;
int Games;
int Progress;
bool IsUnused;
bool IsLeftover;
}
struct Category
{
string Key;
string Description;
}
struct Parameter
{
string Name;
string Type;
int Games;
bool Needed;
string Description;
List<ArgValue> Values;
List<string> Exclusives;
}
public static void LoadDB()
{
JsonSerializerSettings settings = new();
sDatabase = JsonConvert.DeserializeObject<DBFile>(File.ReadAllText("res/objectdb.json"), settings);
}
static DBFile sDatabase;
}However, the deserializer is not throwing an error but every element of
DBFileDBFile is null.https://cdn.discordapp.com/attachments/1177777512525340752/1179410186717364324/image.png?ex=6579ae54&is=65673954&hm=c0ab82bfb39fd7785f407e64f07aaba100ba3cad3f1326bf4a59fb3b4a3935f4&
objectdb.json2.82MB



