MontanaMan
Member
- Joined
- Feb 4, 2022
- Messages
- 8
- Programming Experience
- 5-10
Hello:
I'm downloading APIs and deserializing their JSON content into an object. The JSON structure varies dramatically from day to day. It also has arrays[] of information. So I need an object that can accept varying data structures.
This works:
The problem is ... the "var" declaration can only be used locally. I need to create a separate class object that is public in nature and can accept the changing structure of the JSON data.
How can I create a new public class file that will function like the "MyObject" created with the "var" declaration above?
Thanks!!
I'm downloading APIs and deserializing their JSON content into an object. The JSON structure varies dramatically from day to day. It also has arrays[] of information. So I need an object that can accept varying data structures.
This works:
C#:
var MyObject = JsonConvert.DeserializeObject<dynamic>(JsonString); // This works just fine
The problem is ... the "var" declaration can only be used locally. I need to create a separate class object that is public in nature and can accept the changing structure of the JSON data.
How can I create a new public class file that will function like the "MyObject" created with the "var" declaration above?
Thanks!!
Last edited: