Binding data to list view getting JsonReaderexception

RJ_11RJ_11 Member ✭✭
edited September 2018 in Xamarin.Forms

Unhandled Exception:

Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: [. Path '', line 1, position 1. occurred

Code:-

client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = await client.GetAsync(urlBankDetails + Settings.Username);
var content = await response.Content.ReadAsStringAsync();
var Items = JsonConvert.DeserializeObject<List<BankDetailsModel>>(content);
return Items;


public string Name { get; set; }
public string AccountNumber { get; set; }
public double Amount { get; set; }


JSON data recieved (from postman):-
[
    {
        "Name": "Bank of America",
        "AccountNumber": "123456789",
        "Amount": 401.5
    },
    {
        "Name": "ICICI",
        "AccountNumber": "09876654",
        "Amount": 0
    },
    {
        "Name": "SSCB",
        "AccountNumber": "114578",
        "Amount": 0
    }
]

I have tried multiple things but not able to solve this exception.

Best Answer

Answers

  • RJ_11RJ_11 Member ✭✭

    i have solved it.
    Thanks for the reply.

Sign In or Register to comment.