-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
kind: questionsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Description
I have a json file that looks like this:
{
"name": "Generic Dimmer",
"shortName": "Dimmer",
"manufacturer": "Generic",
"channels": [
{
"type": "intensity",
"name": "Intensity",
"max": 255,
"min": 0,
"displayMax": 100,
"displayMin": 0,
"default": 0,
"dmxAddress": 0,
"value": 0,
"displayValue": 0
}
]
}I was able to import the file and access props such as name, shortName, and manufacturer, but I'm having trouble looping through the channel array.
This is what I've tried so far:
ifstream i("../fixtures/"+fixtureName+".json");
json f;
i >> f;
// Create a new fixture from the fixture spec and save it to the fixtures list
fixture newFixture;
newFixture.id = randomString();
newFixture.name = f["name"];
newFixture.shortName = f["shortName"];
newFixture.manufacturer = f["manufacturer"];
newFixture.startDMXAddress = j["startDMXAddress"];
channel newChannel;
for (auto& x : json::iterator_wrapper(f["channels"]))
{
newChannel.id = randomString();
newChannel.type = x.value()["type"];
cout << "key: " << x.key() << ", value: " << x.value() << '\n';
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind: questionsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation