|
Christian
2020-09-07 06:44:06
|
|
Conversion problem with JSON download.
I'm developing a downloader for JSON files.
Meanwhile all quotes are working but I always get an error message for the dates:
Conversion error: "2020-09-07" -- For every day
In the import module I have already changed the format to YMD and I also use "-" as date separator.
Maybe someone has an idea what I am doing wrong here.
Sample data:
{
"isin": "LU1033693638",
"data": [
{
"date": "2020-09-07",
"open": 24.6,
"close": 24.705,
"high": 24.725,
"low": 24.55,
"turnoverPieces": 6151,
"turnoverEuro": 151878.16
},
{
"date": "2020-09-04",
"open": 24.32,
"close": 24.29,
"high": 24.865,
"low": 24.15,
"turnoverPieces": 11535,
"turnoverEuro": 283828.58
}
],
"totalCount": 46,
"tradedInPercent": false
}
Prescript:
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
for(int i=0;i<Content.Rows.Length;i++)
{
Content.Rows[i].IsIgnoreLine = true;
}
string content = Content.GetContent();
JsonData j = Content.Net.ReadJsonData(content);
JsonData r = j["data"];
for(int i=0;i<r.Count;i++)
{
{
try{
string date = (r[i]["date"] == null) ? "" : r[i]["date"].ToString();
string open = (r[i]["open"] == null) ? "" : r[i]["open"].ToString();
string high = (r[i]["high"] == null) ? "" : r[i]["high"].ToString();
string low = (r[i]["low"] == null) ? "" : r[i]["low"].ToString();
string close = (r[i]["close"] == null) ? "" : r[i]["close"].ToString();
string volume = (r[i]["turnoverPieces"] == null) ? "" : r[i]["turnoverPieces"].ToString();
Content.AddRow(date, open, high, low, close, volume);
}
catch
{
}
}
}
|
|