         if (numPatterns >= MAX_NUM_PATTERNS)  break;
       }
     } else {
-      Serial.println("JSON contains no pattern data");
+      Serial.println(F("JSON contains no pattern data"));
+      return false;
     }
   } else {
-    Serial.println("Could not parse JSON payload");
-  }
+    Serial.print(F("Could not parse JSON payload: "));
+    Serial.println(error.c_str());
+    return false;
+  }
+  return true;
 }
 #endif

    String data = server.arg("plain");
    Serial.println(data);

    json2patterns(data.c_str());
    if (numPatterns > 0) {
      ws2812fx.stop();
      ws2812fx.clear();
      ws2812fx.resetSegments();


#if ARDUINOJSON_VERSION_MAJOR == 5
//#pragma message("Compiling for ArduinoJson v5")
bool json2patterns(const char* json) {
  DynamicJsonBuffer jsonBuffer(2000);
  JsonObject& deviceJson = jsonBuffer.parseObject(json);
  if (deviceJson.success()) {
