Skip to content

Commit

Permalink
#34 fixed quotation of key / values for proper JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Kerspe committed Sep 28, 2022
1 parent 789cfe9 commit c3c9c6c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ESPStepperMotorServer_RestAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,16 +393,16 @@ void ESPStepperMotorServer_RestAPI::registerRestEndpoints(AsyncWebServer *httpSe
request->send(404);
return;
}
request->send(200, "application/json", (String) "{ status: " + this->_stepperMotorServer->getPositionSwitchStatus(switchIndex) + (String) "}");
request->send(200, "application/json", (String) "{ \"status\": \"" + this->_stepperMotorServer->getPositionSwitchStatus(switchIndex) + (String) "\"}");
}
else
{
String output = "{ status: ";
String output = "{ \"status\": \"";
for (int i = ESPServerSwitchStatusRegisterCount - 1; i >= 0; i--)
{
this->_stepperMotorServer->getFormattedPositionSwitchStatusRegister(i, output);
}
request->send(200, "application/json", output + "}");
request->send(200, "application/json", output + "\"}");
}
});

Expand Down

0 comments on commit c3c9c6c

Please sign in to comment.