These are the classes I have which represent the way I want the data to be shown to the end user:
namespace PHCTimeSeriesInsights.API.Models
{
public class ProductTimeSeries
{
public List<DeviceTimeSeries> DeviceTimeSeries { get; set; }
public string DeviceId { get; set; }
}
public class DeviceTimeSeries
{
public DateTime TimeStamp { get; set; }
public Double MeasuredValue { get; set; }
public string DateField { get; set; }
}
}
I want the output in the following format: Here the string 8787887 is an actual value of a device;
{
"8787887":[
{
"prop":"val",
"prop":"val"
},
{
"prop":"val1",
"prop":"val2"
}
]
}
I've this snippet representing what I did but it does not give me an optimal format:
List<ProductTimeSeries> prd = new List<ProductTimeSeries>();
prd.Add(new ProductTimeSeries
{
DeviceId = getTelemetry.PropertyName,
DeviceTimeSeries = deviceIdTimeSeries
});
This is the result that I get:
[
{
"deviceTimeSeries": [
{
"timeStamp": "2019-07-19T17:44:55.856Z",
"measuredValue": 6.98,
"dateField": "7/19/2019"
},
{
"timeStamp": "2019-07-19T17:45:58.697Z",
"measuredValue": 7.04,
"dateField": "7/19/2019"
}
],
"deviceId": "deviceId"
}
]
What changes do I have to make to the format in the way I want?