Can anyone help me with how I should code a c# model to so that I deserialise JSON from a webservice - I thought this would be quick and easy but the JSON is trickier than I expected - when I paste the sample JSON into visual studio and do a paste special > generate class from JSON the resulting class contains objects that are actually the name of the category id's themselves.....can anyone shed any light on how I can structure the model to deserialise the JSON into so that I can get the categories into an IEnumerable of category types ....here is an example of the JSON.....
category — Checkfront API 3.0 documentation
any help gratefully received!
Sachin SinghPosted Jan 25, 2023, 5:32 PM
Yes, I can understand that you must be getting Classes as 1_, 2_,3_ like these.
You need to format the Response to make it array of category object. Or if there is any forum of checkfront API then you can ask there.
Pasang TamangPosted Jan 25, 2023, 3:36 PM
Hi,
You can use https://json2csharp.com/ to generate model from your json.Then you can use Newtonsoft.Json to deserialize JSON response into the model. You can check below code example.
Regards,
Pasang
Rajeesh MenothPosted Jan 25, 2023, 1:43 PM
Newtonsoft Json you can use for all the Serialization & Deserialization in .Net C#. I am not able to see any Json in your question.