I decided to try it anyway, but I'm running into the following problem. The JointSpace API gives the following json reply:
{
"layer1": {
"left": {
"0": {
"r": 254,
"g": 96,
"b": 0
},
"1": {
"r": 255,
"g": 192,
"b": 114
},
"2": {
"r": 254,
"g": 205,
"b": 113
},
"3": {
"r": 132,
"g": 255,
"b": 64
}
},
"top": {
},
"right": {
"0": {
"r": 167,
"g": 255,
"b": 42
},
"1": {
"r": 137,
"g": 255,
"b": 32
},
"2": {
"r": 65,
"g": 254,
"b": 0
},
"3": {
"r": 254,
"g": 120,
"b": 0
}
},
"bottom": {
}
}
}
And I'm trying to retrieve the data as follows:
var ambilightData = Net.WebService(webserviceurl).GetData();
string leftR = ambilightData.layer1.left.0.r.ToString();
HomeGenie won't allow the integer here (won't compile), so I tried to work with indexes:
string leftR = ambilightData.layer1.left[0].r.ToString();
This compiles, but results in the runtime error "Accessed JObject values with invalid key value: 0. Object property name expected."
Anyone know what I'm doing wrong?
Edit: Found the problem, by querying the data as follows it works
string leftR = ambilightData["layer1"]["left"]["0"]["r"];
string leftG = ambilightData["layer1"]["left"]["0"]["g"];
string leftB = ambilightData["layer1"]["left"]["0"]["b"];