           Serial.println("parseObject() failed");
           return;
         }
+        Serial.println(json);
         if(root.containsKey("led")) {
 		if(((String)root["led"].asString()).equals("ON")) set_SensorState_led(&sensorState,"ON");
 		if(((String)root["led"].asString()).equals("OFF")) set_SensorState_led(&sensorState,"OFF");
+                Serial.println(root["led"].asString());
 	} 
-	if (root.containsKey("temperaturec")) {			
-		set_SensorState_temperaturec(&sensorState,stringToDouble(root["temperaturec"].asString()));
-	} 
-	if (root.containsKey("brightness")) {
-		set_SensorState_brightness(&sensorState,stringToDouble(root["brightness"].asString()));
-	}
 	if (root.containsKey("threshold_brightness")) {
-		set_SensorState_thresholdbrightness(&sensorState,stringToDouble(root["threshold_brightness"].asString()));
+		set_SensorState_thresholdbrightness(&sensorState,(double)root["threshold_brightness"]);
 	}
 	if (root.containsKey("threshold_temperature")) {
-		set_SensorState_thresholdtemperature(&sensorState,stringToDouble(root["threshold_temperature"].asString()));
+		set_SensorState_thresholdtemperature(&sensorState,(double)root["threshold_temperature"]);
 	}
 }
 

        char json[len+1];
        root.prettyPrintTo(json, sizeof(json));
        return json;
        /*String json = "{";
	json += "\"led\":\"" + (String)get_SensorState_led(&sensorState) + "\",";
	json += "\"temperature_f\":"+ dtostrf(get_SensorState_temperaturef(&sensorState),0,4) + ",";
        json += "\"temperature_c\":"+ dtostrf(get_SensorState_temperaturec(&sensorState),0,4) + ",";
	json += "\"brightness\":" + dtostrf(get_SensorState_brightness(&sensorState),0,4) + ",";
	json += "\"threshold_brightness\":"+ dtostrf(get_SensorState_thresholdbrightness(&sensorState),0,4) + ",";
	json += "\"threshold_temperature\":"+ dtostrf(get_SensorState_thresholdtemperature(&sensorState),0,4);
	json += "}";
	return json;*/
}

void parseDatastructureFromJson(String json) {

  
        DynamicJsonBuffer jsonBuffer;
        JsonObject& root = jsonBuffer.createObject();
        JsonObject& ledToggle = root.createNestedObject("ledToggle");
        JsonObject& alertTemp = root.createNestedObject("alertThresholdTemperature");
        JsonObject& alertBright = root.createNestedObject("alertThresholdBrightness");
        
        ledToggle["led"] = get_SensorState_led(&sensorState);
        alertTemp["threshold_temperature"] = get_SensorState_thresholdtemperature(&sensorState);
