I'm trying to access the individual tags from the Json Web API. if you look at my Debug message you can see that every tag is shown with correct data in "jsonMessage", but when i return "result" every tag is set to null:
So how to I get all the tags from jsonMessage to return so I can just type for example texblock.text = card.name; and so forth
public async static Task<Card> GetCard()
{
string url = String.Format("https://api.magicthegathering.io/v1/cards/386616");
HttpClient client = new HttpClient();
//client.BaseAddress = new Uri(url);
var response = await client.GetAsync(url);
var jsonMessage = await response.Content.ReadAsStringAsync();
var serializer = new DataContractJsonSerializer(typeof(Card));
var ms = new MemoryStream(Encoding.UTF8.GetBytes(jsonMessage));
var result = (Card)serializer.ReadObject(ms);
return result;
}
Here's the Cards class:
public class Card
{
public string name { get; set; }
public string manaCost { get; set; }
public int cmc { get; set; }
public List<string> colors { get; set; }
public string type { get; set; }
public List<string> types { get; set; }
public List<string> subtypes { get; set; }
public string rarity { get; set; }
public string set { get; set; }
public string text { get; set; }
public string artist { get; set; }
public string number { get; set; }
public string power { get; set; }
public string toughness { get; set; }
public string layout { get; set; }
public int multiverseid { get; set; }
public string imageUrl { get; set; }
public List<Ruling> rulings { get; set; }
public List<ForeignName> foreignNames { get; set; }
public List<string> printings { get; set; }
public string originalText { get; set; }
public string originalType { get; set; }
public List<Legality> legalities { get; set; }
public string id { get; set; }
}
