public class JSON_Browse_Root
{
public string browse_content { get; set; }
public List<JSON_Browse_Content> Content { get; set; }
}
public class JSON_Browse_Content
{
public string link { get; set; }
public string image { get; set; }
public string title { get; set; }
public string description { get; set; }
public string rating { get; set; }
public string genre { get; set; }
}
using (var client = new HttpClient())
{
using (HttpResponseMessage response = await client.GetAsync("https://myjsonurl.com"))
using (HttpContent responseData = response.Content)
{
var jsonData = await responseData.ReadAsStringAsync();
var root = JsonConvert.DeserializeObject<JSON_Browse_Root>(jsonData);
}
}
JSON:
{
"browse_content": [
{
"link": "https:\/\/blah",
"image": "https:\/\/blahblah.blah.gif",
"title": "Mr. Southern Hospitality",
"description": "He got old money",
"rating": "e",
"author": "",
"genre": "Comedy - Original"
},
{
"link": "https:\/\/blah",
"image": "https:\/\/blahblah.blah.png",
"title": "Throwverwatch",
"description": "Based on the competitive overwatch experience",
"rating": "t",
"author": "",
"genre": "Comedy - Parody"
}
An exception of type 'Newtonsoft.Json.JsonReaderException' occurred in System.Private.CoreLib.ni.dll but was not handled in user code Unexpected character encountered while parsing value: [
I used this JSON for iOS and Android apps and it's worked perfectly. Also, jsonlint.com says the JSON is valid. Not sure why it's erroring out on the [ character.
] }missing. What do you mean by jsonLint says it's okay? What have you tested there?Parse error on line 18. Wonder how you got it to say it was valid