need to deserialize this JSON using newtonsoft.json.net:
{
"dataset": {
"id": 36592406,
"dataset_code": "EON_X",
"database_code": "FSE",
"start_date": "2019-11-18",
"end_date": "2019-11-18",
"data": [
[
"2019-11-18",
9.17,
9.204,
9.121,
9.167,
null,
6088172.0,
55793844.0,
null,
null,
null
]
]
}
}
to List<FseItem>
. Problem is that i need only "data" part. I was trying to use this:
var settings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore,
MissingMemberHandling = MissingMemberHandling.Ignore
};
var json = GetResult(url);
var obj = JsonConvert.DeserializeObject<List<FseItem>>(json, settings);
here is my FseItem object:
public class FseItem
{
public DateTime Date { get; set; }
public decimal Open { get; set; }
public decimal High { get; set; }
public decimal Low { get; set; }
public decimal Close { get; set; }
public decimal Change { get; set; }
public decimal TradedVolume { get; set; }
public decimal TurnOver { get; set; }
public decimal LastPrice { get; set; }
public decimal TradedUnits { get; set; }
public decimal DailyTurnover { get; set; }
}
but i get this error:
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[InvestorWeb2.WebUI.Domain.QwertyReporting.FseReport+FseItem]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
I get my JSON from Quandl free databases, so i can't change anything in json data. In this example json contain only one element, but i will work with big json files as well. What are problems in my code, and what should i do to fix them?
Fast solution for a lot of data and some advice about parsing and working with big json's will be appreciated!