Bugfix json serialization
This commit is contained in:
parent
3f5d795e15
commit
6fb4de6752
|
@ -100,9 +100,9 @@ public abstract class Trigger {
|
|||
static Trigger instantiate(JSONObject object) {
|
||||
try {
|
||||
String type = object.getString("type");
|
||||
String data = object.getString("data");
|
||||
JSONObject data = object.getJSONObject("data");
|
||||
Class clazz = Class.forName(type);
|
||||
return ((Trigger) clazz.newInstance()).fromJSON(data);
|
||||
return ((Trigger) clazz.newInstance()).fromJSON(data.toString());
|
||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class TriggerBg extends Trigger {
|
|||
data.put("threshold", threshold);
|
||||
data.put("comparator", comparator.toString());
|
||||
data.put("units", units);
|
||||
o.put("data", data.toString());
|
||||
o.put("data", data);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ public class TriggerTime extends Trigger {
|
|||
data.put("minute", minute);
|
||||
data.put("validTo", validTo);
|
||||
object.put("type", TriggerTime.class.getName());
|
||||
object.put("data", data.toString());
|
||||
object.put("data", data);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue