Given it's now C# and the datatypes should come across through the reader, the following should work:
// use a struct to store your retrieved information
public struct Details
{
DateTime date;
Object data;
public Details(DateTime Date, Object Data)
{
date = Date;
data = Data;
}
}
// use List<T> to define a dynamically-sized list
List<Details> dataArray = new List<Details>();
while (reader.Read()) // query the database
{
// add the information to the list as we iterate over it
dataArray.Add(new Details(reader.GetDateTime("Date"),reader["Data"]));
}
// your new expansive array: dataArray.ToArray();
// converting an object to datetime: Convert.ToDateTime();
This also assumes you're using a SqlDataReader (though you could use almost anything to retrieve the information from SQL).
Update
Given the comments below, the information is retrieved from a database and then output to JSON. Because of the new requirement I am going to change the store format a bit. This gives the flexibility to continue using the JavaScriptSerializer while outputting to a format javascript can understand.
// make a list we can use
List<Object[]> details = new List<Object[]>();
// populate the data
using (SqlConnection connection = new SqlConnection("<connection string>"))
{
SqlCommand command = new SqlCommand("<query string>");
SqlReader reader = command.ExecuteReader();
.. go through the database
while (reader.Read())
{
DateTime date = reader.GetDateTime("Date");
Double data = reader.GetDouble("Data");
// convert the datetime to unix time
// http://www.epochconverter.com/
var epoc = (date.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
details.Add(new Object[]{ epoc, data });
}
}
// Now we serialize
JavaScriptSerializer serializer = new JavaScriptSerializer();
String result = serializer.Serialize(details.ToArray());
And here's what I receive from result
(for format anyways):
[
[1297627668,0.7],
[1297714068,1.1],
[1297800468,0.1],
...
]