       animator.StartAnimation(numberOfTheLight, transitionTime, animUpdate);
     }
 
-    JsonObject& lightJson = jsonBuffer.createObject();
-    addLightJson(lightJson, numberOfTheLight);
-    // lightJson.printTo(HTTP.client()); // FIXME: Why is this not working? Gives "no matching function for call to 'ArduinoJson::JsonObject::printTo(WiFiClient)'"
-    char buffer[256];
-    lightJson.printTo(buffer, sizeof(buffer));
-    HTTP.send(200, "text/plain", buffer);
-    Serial.println(buffer);
+    aJsonObject *root;
+    root = aJson.createObject();
+    addLightJson(root, numberOfTheLight);
+    sendJson(root);
   }
 
   else if (requestedUri == "/description.xml")

  {
    // For this to work we need a patched version of esp8266/libraries/ESP8266WebServer/src/Parsing.cpp which hopefully lands in the official channel soon
    // https://github.com/me-no-dev/Arduino/blob/d4894b115e3bbe753a47b1645a55cab7c62d04e2/hardware/esp8266com/esp8266/libraries/ESP8266WebServer/src/Parsing.cpp
    Serial.println(HTTP.arg("plain"));
    int numberOfTheLight = atoi(subStr(requestedUri.c_str(), "/", 4)) - 1; // The number of the light to be switched; they start with 1
    Serial.print("Number of the light --> ");
    Serial.println(numberOfTheLight);

    StaticJsonBuffer<200> jsonBuffer;
    JsonObject& root = jsonBuffer.parseObject(( char*) HTTP.arg("plain").c_str());
    if (!root.success()) {
      Serial.println("parseObject() failed");
      return;
    }
    bool onValue = root["on"];
    Serial.print("I should --> ");
    Serial.println(onValue);
    // define the effect to apply, in this case linear blend
    HslColor originalColor = strip.GetPixelColor(numberOfTheLight);

    if (onValue == true)
    {
      AnimUpdateCallback animUpdate = [ = ](float progress)


  if ( requestedUri.endsWith("/config") )
  {
    aJsonObject *root;
    root = aJson.createObject();
    addConfigJson(root);
    sendJson(root);
  }

  else if ((requestedUri.startsWith("/api") and (requestedUri.lastIndexOf("/") == 4 )))
  {
    // Serial.println("Respond with complete json as in https://github.com/probonopd/ESP8266HueEmulator/wiki/Hue-API#get-all-information-about-the-bridge");
    aJsonObject *root;
    root = aJson.createObject();
    aJsonObject *groups;
    aJson.addItemToObject(root, "groups", groups = aJson.createObject());
    aJsonObject *scenes;
    aJson.addItemToObject(root, "scenes", scenes = aJson.createObject());
    aJsonObject *config;
    aJson.addItemToObject(root, "config", config = aJson.createObject());
    addConfigJson(config);
    aJsonObject *lights;
    aJson.addItemToObject(root, "lights", lights = aJson.createObject());
    for (int i = 1; i <= 8; i++) // FIXME: Why does this not work for more than 8?
      addLightJson(lights, i);
    aJsonObject *schedules;
    aJson.addItemToObject(root, "schedules", schedules = aJson.createObject());
    sendJson(root);

  }

  else if (requestedUri.endsWith("/api"))
