I'm trying to deserialize this json:
{"name":"FC Internazionale Milano","y":55},{"name":"AC Chievo Verona","y":45,"sliced":true}
which is available inside that function that's contained in a string:
window.addEvent('domready', function() {
var chart = new PieChart('Possession');
chart.addSeries('Possession', [{"name":"FC Internazionale Milano","y":55},{"name":"AC Chievo Verona","y":45,"sliced":true}]);
chart.highChartsOptions.plotOptions.pie.topmargin = '20';
chart.highChartsOptions.plotOptions.pie.size = "80%";
chart.highChartsOptions.plotOptions.pie.center = ['50%', '55%'];
chart.render('page_chart_1_chart_statsplus_1_chart_possession_1-wrapper');
});
for the get json I used this regex:
System.Text.RegularExpressions.Regex.Match(script, @"Possession[^\{]+(.*})").Groups[1].Value;
which return the json above. So I deserialized in this way:
var json = JsonConvert.DeserializeObject<JsonMatchStat>(jsonStr);
the structure of JsonMatchStat
is this:
public class JsonMatchStat
{
public string name { get; set; }
public int y { get; set; }
public bool? sliced { get; set; }
}
when I deserialize the json I get:
'Additional text encountered after finished reading JSON content: ,. Path '', line 1, position 42.'
what I did wrong?
>(jsonStr);
– Adeoluwa Simeon Apr 24 '18 at 14:00