Trying to make sense of JSON structuring

I am a private teacher by trade, but always wanted to be more of a hobby programmer, so I took it upon myself to write a little app to help with my scheduling and whatnot. It seems to me that I'll want to store / access my data through JSON, at least intially while I'm learning as I go. I could use a little help with what makes the most sense in regards to structuring my data. Attached image is currently the outline of what I'm working with, and though it makes sense to my eyes and my brain, I copy and paste it into json2csharp.com and the outline it gives me doesn't really match what I would expect. I'm assuming there's some things that my head is just not quite making complete sense with the JSON here. Would appreciate some advice / nudges in the right direction if possible!
No description
3 Replies
Angius
Angius10mo ago
In pseudocode, it seems like you have
Root {
List<Week> WeeklySchedule
}

Week {
List<Item> Sunday
List<Item> Monday
List<Item> Tuesday
// etc
}

Item {
Student Student
}

Student {
string FirstName
string LastName
// ...
}
Root {
List<Week> WeeklySchedule
}

Week {
List<Item> Sunday
List<Item> Monday
List<Item> Tuesday
// etc
}

Item {
Student Student
}

Student {
string FirstName
string LastName
// ...
}
Alternatively,
Root {
Dictionary<string, List<Item>> WeeklySchedule
}

Item {
Student Student
}

Student {
string FirstName
string LastName
// ...
}
Root {
Dictionary<string, List<Item>> WeeklySchedule
}

Item {
Student Student
}

Student {
string FirstName
string LastName
// ...
}
I wouldn't start with json, tbh It's just there for storage Create the structure you want with C# classes/records/whatever, then serialize it
mattatmattatmattatmatt
That...makes a lot more sense doesn't it I'm not sure why I didn't think about doing it the other way lol Much appreciated for the quick tip!
Angius
Angius10mo ago
Anytime :Ok:
Want results from more Discord servers?
Add your server