C
C#3y ago
DeltaDizzy

✅ Determine the .NET type of a json object

I have a json generated by another program that i want to deserialize and manipulate the data of (using newtonsoft.json), but I am unsure what the .NET type I am deserializing it into should look like. The json file is attached.
8 Replies
Angius
Angius3y ago
$jsongen
MODiX
MODiX3y ago
Use https://app.quicktype.io or https://json2csharp.com to generate classes from your JSON
Instantly parse JSON in any language | quicktype
Whether you're using C#, Swift, TypeScript, Go, C++ or other languages, quicktype generates models and helper code for quickly and safely reading JSON in your apps. Customize online with advanced options, or download a command-line tool.
Convert JSON to C# Classes Online - Json2CSharp Toolkit
Convert any JSON object to C# classes online. Json2CSharp is a free toolkit that will help you generate C# classes on the fly.
Angius
Angius3y ago
(also, just use STJ, no need for Newtonsoft nowadays)
phaseshift
phaseshift3y ago
Also you can 'just paste' and theres an option in recent releases of studio to do that for you
DeltaDizzy
DeltaDizzyOP3y ago
huh neat ill admit i dont keep up with the community side of stuff a lot
Angius
Angius3y ago
Edit -> paste special -> json as classes Yeah, VS and Rider have it built-in Not really "community side"
DeltaDizzy
DeltaDizzyOP3y ago
well that includes the tools i guess
Accord
Accord3y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?