A member with the name 'articles' already exists on 'Result'. Use the JsonPropertyAttribute to specify another name.
Make the articles
field private
:
private List<Article> articles;
A member with the name 'text' already exists on 'Article'. Use the JsonPropertyAttribute to specify another name.
same again:
private string text;
private int id;
private int date;
private string title;
private string author;
private string imageURL;
or better - use automatically implemented properties and throw away the fields, i.e.
[JsonProperty("text")]
public string Text {get;set;}
Arithmetic operation resulted in an overflow.
Make Date
a long
:
[JsonProperty("date")]
public long Date {get;set;}
Here's my entire working classes afterwards:
class News
{
[JsonProperty("jsonrpc")]
public string Jsonrpc {get;set;}
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("result")]
public Result Result { get; set; }
}
public class Result
{
private List<Article> articles = new List<Article>();
[JsonProperty("articles")]
public List<Article> Articles { get { return articles; }}
}
public class Article
{
[JsonProperty("text")]
public string Text {get;set;}
[JsonProperty("id")]
public int Id {get;set;}
[JsonProperty("date")]
public long Date {get;set;}
[JsonProperty("title")]
public string Title {get;set;}
[JsonProperty("author")]
public string Author { get; set; }
[JsonProperty("imageURL")]
public string ImageURL { get; set; }
}
Note that if you are only deserializing you don't even need the JsonProperty
- since the names are all identical except for the case, this would only matter if you were also serializing.