'Json Deserializer retrieves null value in Xamarin

I have a Xamarin Forms App and all the code seems to be correct, but when I try to serialize the response from the GetAsync request to a Collection the Collection has all of his values null. I already tried with List but same result.

enter image description here

Observable Collection:

        public ObservableCollection<News> NewsCollection
        {
            get { return _newsCollection; }
            set
            {
                _newsCollection = value;
            }
        } 

Get Request Method:

 public async Task<ObservableCollection<News>> GetNews()
        {
                var client = new HttpClient();

                var uri = "http://192.168.1.69:8080/news";
                var response = await client.GetAsync(uri);

                if (response.IsSuccessStatusCode)
                {
                    var content = await response.Content.ReadAsStringAsync();
                    NewsCollection = JsonConvert.DeserializeObject<ObservableCollection<News>>(content);
                }

                return NewsCollection;
        }

My Class:

 public class News
    {
        private int id { get; set; }
        private string title { get; set; }
        private string description { get; set; }
        private string link { get; set; }
    }

MY JSON:

"[{\"newId\":11,\"title\":\"Coins Lose All Intrest, Bitcoin Rules \",\"description\":\"Lorem ipsu mipsm lorum O estado adota a moeda digital Bitcoin como moeda oficial do pais. Grande alta nos mercados crypto depois desta noticia ter explodido bla bl bla bla \",\"link\":\"www.fakeNews.com\"},{\"newId\":12,\"title\":\"Coins Lose All Intrest, Bitcoin Rules \",\"description\":\"Lorem ipsu mipsm lorum O estado adota a moeda digital Bitcoin como moeda oficial do pais. Grande alta nos mercados crypto depois desta noticia ter explodido bla bl bla bla \",\"link\":\"www.fakeNews.com\"},{\"newId\":13,\"title\":\"Coins Lose All Intrest, Bitcoin Rules \",\"description\":\"Lorem ipsu mipsm lorum O estado adota a moeda digital Bitcoin como moeda oficial do pais. Grande alta nos mercados crypto depois desta noticia ter explodido bla bl bla bla \",\"link\":\"www.fakeNews.com\"},{\"newId\":14,\"title\":\"Coins Lose All Intrest, Bitcoin Rules \",\"description\":\"Lorem ipsu mipsm lorum O estado adota a moeda digital Bitcoin como moeda oficial do pais. Grande alta nos mercados crypto depois desta noticia ter explodido bla bl bla bla \",\"link\":\"www.fakeNews.com\"},{\"newId\":16,\"title\":\"Coins Lose All Intrest, Bitcoin Rules \",\"description\":\"Lorem ipsu mipsm lorum O estado adota a moeda digital Bitcoin como moeda oficial do pais. Grande alta nos mercados crypto depois desta noticia ter explodido bla bl bla bla \",\"link\":\"www.fakeNews.com\"},{\"newId\":17,\"title\":\"Coins Lose All Intrest, Bitcoin Rules \",\"description\":\"Lorem ipsu mipsm lorum O estado adota a moeda digital Bitcoin como moeda oficial do pais. Grande alta nos mercados crypto depois desta noticia ter explodido bla bl bla bla \",\"link\":\"www.fakeNews.com\"},{\"newId\":18,\"title\":\"Coins Lose All Intrest, Bitcoin Rules \",\"description\":\"Lorem ipsu mipsm lorum O estado adota a moeda digital Bitcoin como moeda oficial do pais. Grande alta nos mercados crypto depois desta noticia ter explodido bla bl bla bla \",\"link\":\"www.fakeNews.com\"}]"



Solution 1:[1]

Verify your class, your need public methods to serialize.

public class News
{
    private int id { get; set; }
    private string title { get; set; }
    ...
}

Try

public class News
{
    public int id { get; set; }
    public string title { get; set; }
    ...
}

https://www.newtonsoft.com/json/help/html/SerializationGuide.htm#Objects

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mate