Forum Xamarin Xamarin.Android

Getting a deserialing error when getting from the Wordpress rest API, unexpected { in [0].title

am a Yr13 (17/18 Yr old) working on an agile project in a team for college.

We are creating an application in Xamarin that is aimed at the Android market. We need to pull a list of objects off of the Wordpress API in order to populate a list view.

The code seems to be erroring at the deserialisation part of the code. EventLW is a ListView on the front-end of the application.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using System.Net.Http;
using Newtonsoft.Json;

namespace StudioDen.View
    public partial class Events : ContentPage
        public Events()



        private async void GetProducts()
            HttpClient client = new HttpClient();
        var response = await client.GetStringAsync("");

            var events = JsonConvert.DeserializeObject<List<Events>>(response);
            eventLV.ItemsSource = events;

When running this, it errors on load with this

Newtonsoft.Json.JsonReaderException Message=Unexpected character encountered while parsing value: {. Path '[0].title', line 1, position 341.

Any ideas on what is going wrong here? I followed a youtube tutorial and I don't think it is an issue with the code directly but with the JSON string from the call.

Sign In or Register to comment.