I'm making calls to an api from asp.net website using http request. The api returns data in JSON.
The request is something like this: GET/stats/{granularity}/{customer_number}/{timestamp_start}/{timestamp_end}.
The problem is that the data returned depends on the timestamps you entered in the request.
This is a sample example:
{
"success": {
"1310860635": {
"1396310400": {
"iPad": 2317357,
"Other": 564
},
"1396915200": {
"iPad": 2538835,
"Other": 372
},
"1396656000": {
"iPad": 2349576,
"Other": 1136
},
"1398729600": {
"iPad": 1648157,
"Other": 163,
"HTC Streaming P": 32
},
"1397606400": {
"iPad": 2018706,
"Other": 788
},
"1396396800": {
"iPad": 2477197,
"Other": 608,
"Spider": 2
},
"1397692800": {
"iPad": 2144772,
"Other": 576
},
"1398816000": {
"iPad": 2117556,
"Other": 1838,
"HTC Streaming P": 14
},
"1398124800": {
"iPad": 2662858,
"Other": 306,
"Spider": 3
},
"1398038400": {
"iPad": 2658527,
"Other": 565,
"HTC Streaming P": 98,
"Spider": 1
},
"1397260800": {
"iPad": 1696601,
"Other": 218
},
"1396483200": {
"iPad": 2431192,
"Other": 204
},
"1398297600": {
"iPad": 2186146,
"Other": 567
},
"1397001600": {
"iPad": 330815,
"Other": 32
},
"1398211200": {
"iPad": 2457731,
"Other": 381
},
"1397347200": {
"iPad": 2037233,
"Other": 175
},
"1397779200": {
"iPad": 2438668,
"Other": 445,
"HTC Streaming P": 40
},
"1396569600": {
"iPad": 517843,
"Other": 52,
"Spider": 1
},
"1397433600": {
"iPad": 1517589,
"Other": 161
},
"1398902400": {
"iPad": 2059013,
"Other": 1878
},
"1397174400": {
"iPad": 338428,
"Other": 57
},
"1397520000": {
"iPad": 2024273,
"Other": 214
},
"1397088000": {
"iPad": 275725,
"Other": 21
},
"1398384000": {
"iPad": 2511796,
"Other": 586
},
"1397865600": {
"iPad": 2585367,
"Other": 613
},
"1398470400": {
"iPad": 2558398,
"Other": 327
},
"1398556800": {
"iPad": 1447445,
"Other": 97
},
"1398643200": {
"iPad": 1475406,
"Other": 161
},
"1396742400": {
"iPad": 2838708,
"Other": 484
},
"1396828800": {
"iPad": 2502484,
"Other": 513
},
"1397952000": {
"iPad": 2724871,
"Other": 371
}
}
}
}
Is there any way to map this json data to a C# class, which should not depend on timestamp which varies on every request?