The response is structured like this, this is an extract, might be missing a curly brace:
{"2":{"date":1306411951,"price":4.8003,"low":"4.80000000","high":"4.80060000","nicedate":"15:12"},"6":{"date":1306418941,"price":4.654175,"low":"4.40000000","high":"4.80000000","nicedate":"17:02"}
And I get cast exceptions when parsing the response string even though all the datamembers in the object are strings.
I'm using System.Runtime.Serialization.Json to deserialize the objects.
Right now I'm doing it like this:
Currency[] MapJSONToObjects(string jsonString)
{
using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(jsonString)))
{
//Parse
var ser = new DataContractJsonSerializer(typeof(Currency[]));
Currency[] currencies = (Currency[])ser.ReadObject(ms);
return currencies;
}
}