❔ Am trying to convert this json into a data object.
I have a data object which has matching properties to what's contained in the JSON. As can be seen in the image the JSON file is being pulled through correctly. I am hoping for my list 'b' to be list of my data object. Would be very grateful for any help.
12 Replies
Here are the variables I have declared on the bodies class
You need properties
JSON serializer doesn't work with fields
Especially since they're private
consider pasting the json into a tool which creates the classes for you, you need a root object that contains the bodies property you can't deserialize it directly to a list
$jsongen
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.
Or Edit -> Paste Special -> JSON As Classes
I love you guys
thanks
So would something like this do the trick?
It worked 🙂
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.