NullReference from API JSON
Hello,
I'm trying to retrieve some data from TMDB API, but there's this attribute that is named "watch/providers" in the JSON, and in my Model I can't name it like this because of the "/", so my method returns null for this specific data because it won't match the JSON.
Is there anyway to retrieve this data having the Model attribute with a different name from the JSON?
2 Replies
You can use
[JsonPropertyName]
attribute
Or [JsonProperty]
I can never remember which one's for Newtonsoft and which one for STJThen I need to use STJ for serialization
I'm using DataContractJsonSerializer
I'll try that
Yes, it worked!