Hey there. I am writing a program using the Deck of Cards API which can be found here: https://deckofcardsapi.com/. The API returns a response which contains JSON.
class Deck { public Deck() { ... } public Card DrawCard() { ... }}
class Deck { public Deck() { ... } public Card DrawCard() { ... }}
I have a class named "Deck", I first wanted "Deck" to load and deserialize itself in the constructor using the API but I don't really know if that's possible or a good idea. I am wondering if there are better alternatives or best practices for this problem.
class Card{ public string Value; public string Suit; public string Image;}
class Card{ public string Value; public string Suit; public string Image;}
I also have a second problem. Whenever I want to request a card using the API, the response contains many properties I don't need. Is there a way of only deserializing certain properties? Above you can see a class called "Card" and I only need "Value", "Suit", and "Image" but the JSON in the response contains much more as you can see below.