JSON Deserialization Multiple Entries
Hello. Is there an easy way to enumerate through this .json and pull out the data I need onto a UI? Stuff like Prop ID, Prop Name, etc. Of courses there's multiple props per .json so I'd need to be able to deserialize them all, edit them, and reserialize back.
(WinForms but it dont matter)
31 Replies
you could use Model classes
wait ill look for my example
with this approach you can easily create objects from your JSON and use it in your applications
thx, i had a feeling it was model based
its from flatbuffers converted to json, sadly, i dont own or know the original schema
but this will do
oki
i appreciate your fast response
this is very simple to setup i love this approach a lot
no problem!
game modding can be fun but tedious (OFFLINE ONLY)
Whats your take on Codeium + actually coding ? like a sidekick
honestly ive never heard of it :SCgetoutofmyhead:
is it that AI assistant?
yeah i found it on Free Media Heck Yeah
its supposed to be better than Copilot
i prefer to code myself and read but its helpful maybe lol
Codeium · Free AI Code Completion & Chat
Codeium offers best in class AI code completion, search, and chat — all for free. It supports over 70+ languages and integrates with your favorite IDEs, with lightning fast speeds and state-of-the-art suggestion quality.
honestly if you can code, AI can be a powerful assistant, as long as you can work with the outcome its fine
i regularily use Chat GPT to ask questions abt concepts to implement, if im unsure ill just have a convo with the people here
so as long as you know what youre doing youre good to go tbh
yeah AI is not fool proof of course, id never use it for production just on stuff i need a hint for etc
bet
@Thing from Human Resources Have you used a TreeView?
having issues getting it to populate
the data is outputting fine otherwise XD
other class
got it so far
Thank you so much
I've made huge improvements since 🙂
here's a dumb question
how do i handle nulls?
not every entry has the same field
heres the deserialize method
but not sure how to handle unk_13 which some entries have and some even have a unk_0 inside the unk_13's etc
probably need a dictionary and jobject parse there, i'll toy with it later
dont use Newtonsoft json
do you need those at all?
yep, its part of the flatbuffer, but not ALL entries have one
Can you do an example w/o it? (I assume System.Text.Json)
1. If your property names match the JSON name you dont need the extra
[JsonPropertyName]
, you can use this however to assign json key state
for a variable called State
tho (this would be more appropriate for C# naming conventions too)
2. You can just do MyObject test = JsonSerializer.Deserialize<MyObject>(myJsonString);
I think you're in custom (de)serialization territory.
yep, that be a given
There's some trial and error that goes on there, any time I need to do it, it's across years.
So I'm basically starting over with the docs
Yeah, since the schemas are unknown, its a game modding thing so no one is going to have them except the devs of course. I mean I know the fields 90%. But how come so many say use System.Text.Json over Newtonsoft's? Besides Newtownsoft's being outdated.
oh it's game modding