public void setState(int state) { if (this.firmware == null) { return; } object[] field = new object[1]; field[0] = new { field = "mgmt.firmware", value = new { state = state } }; var notify = new { d = new { fields = field } }; this.firmware.state = state; string json = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(notify); parentGateway.notify(this.deviceType, this.deviceId, json); }