Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Binding data to list view getting JsonReaderexception

$
0
0

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>(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.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>