	public static Task parse_json(JsonObject el, AccountMirakel account) {
		Task t = null;
		JsonElement id = el.get("id");
		if (id != null) {
			t = Task.get(id.getAsLong());
		} else {
			id = el.get("uuid");
			if (id != null) {
				t = Task.getByUUID(id.getAsString());
			}
		}
		if (t == null) {
			t = new Task();
		}
		Set<Entry<String, JsonElement>> entries = el.entrySet();
		for (Entry<String, JsonElement> entry : entries) {
			String key = entry.getKey();
			JsonElement val = entry.getValue();
			if (key == null || key.equals("id")) {
				continue;
			}
			if (key.equals("uuid")) {
				t.setUUID(val.getAsString());
			} else if (key.equals("name") || key.equals("description")) {
				t.setName(val.getAsString());
			} else if (key.equals("content")) {
				String content = val.getAsString();
				if (content == null) {
					content = "";
				}
				t.setContent(content);
			} else if (key.equals("priority")) {
				String prioString = val.getAsString().trim();
				if (prioString.equals("L") && t.getPriority() != -1) {
					t.setPriority(-2);
				} else if (prioString.equals("M")) {
					t.setPriority(1);
				} else if (prioString.equals("H")) {
					t.setPriority(2);
				} else if (!prioString.equals("L")) {
					t.setPriority(val.getAsInt());
				}
			} else if(key.equals("progress")) {
				int progress=(int) val.getAsDouble();
				t.setProgress(progress);
			} else if (key.equals("list_id")) {
				ListMirakel list = ListMirakel.getList(val.getAsInt());
				if (list == null) {
					list = SpecialList.firstSpecial().getDefaultList();
				}
				t.setList(list, true);
			} else if (key.equals("project")) {
				ListMirakel list = ListMirakel.findByName(val.getAsString(),
						account);
				if (list == null
						|| list.getAccount().getId() != account.getId()) {
					list = ListMirakel.newList(val.getAsString(),
							ListMirakel.SORT_BY_OPT, account);
				}
				t.setList(list, true);
			} else if (key.equals("created_at")) {
				t.setCreatedAt(val.getAsString().replace(":", ""));
			} else if (key.equals("updated_at")) {
				t.setUpdatedAt(val.getAsString().replace(":", ""));
			} else if (key.equals("entry")) {
				t.setCreatedAt(parseDate(val.getAsString(),
						context.getString(R.string.TWDateFormat)));
			} else if (key.equals("modification")||key.equals("modified")) {
				t.setUpdatedAt(parseDate(val.getAsString(),
						context.getString(R.string.TWDateFormat)));
			} else if (key.equals("done")) {
				t.setDone(val.getAsBoolean());
			} else if (key.equals("status")) {
				String status = val.getAsString();
				if (status.equals("pending")) {
					t.setDone(false);
				} else if (status.equals("deleted")) {
					t.setSyncState(SYNC_STATE.DELETE);
				} else {
					t.setDone(true);
				}
				t.addAdditionalEntry(key, "\"" + val.getAsString() + "\"");
			} else if (key.equals("due")) {
				Calendar due = parseDate(val.getAsString(), "yyyy-MM-dd");
				if (due == null) {
					due = parseDate(val.getAsString(),
							context.getString(R.string.TWDateFormat));
					if (due != null) {
						due.setTimeInMillis(due.getTimeInMillis()
								+ TimeZone.getDefault().getRawOffset());
					}
				}
				t.setDue(due);
			} else if (key.equals("reminder")) {
				Calendar reminder = parseDate(val.getAsString(), "yyyy-MM-dd");
				if (reminder == null) {
					reminder = parseDate(val.getAsString(),
							context.getString(R.string.TWDateFormat));
				}
				t.setReminder(reminder);
			} else if (key.equals("annotations")) {
				String content = "";
				try {
					JsonArray annotations = val.getAsJsonArray();
					boolean first = true;
					for (JsonElement a : annotations) {
						if (first) {
							first = false;
						} else {
							content += "\n";
						}
						content += a.getAsJsonObject().get("description")
								.getAsString();
					}
				} catch (Exception e) {
					Log.e(TAG, "cannot parse json");
				}
				t.setContent(content);
			} else if (key.equals("content")) {
				t.setContent(val.getAsString());
			} else if (key.equals("sync_state")) {
				t.setSyncState(SYNC_STATE.parseInt(val.getAsInt()));
			} else if (key.equals("depends")) {
				t.setDependencies(val.getAsString().split(","));
			} else {
				if (val.isJsonPrimitive()) {
					JsonPrimitive p = (JsonPrimitive) val;
					if (p.isBoolean()) {
						t.addAdditionalEntry(key, val.getAsBoolean() + "");
					} else if (p.isNumber()) {
						t.addAdditionalEntry(key, val.getAsInt() + "");
					} else if (p.isJsonNull()) {
						t.addAdditionalEntry(key, "null");
					} else if (p.isString()) {
						t.addAdditionalEntry(key, "\"" + val.getAsString()
								+ "\"");
					} else {
						Log.w(TAG, "unkown json-type");
					}
				} else if (val.isJsonArray()) {
					JsonArray a = (JsonArray) val;
					String s = "[";
					boolean first = true;
					for (JsonElement e : a) {
						if (e.isJsonPrimitive()) {
							JsonPrimitive p = (JsonPrimitive) e;
							String add;
							if (p.isBoolean()) {
								add = p.getAsBoolean() + "";
							} else if (p.isNumber()) {
								add = p.getAsInt() + "";
							} else if (p.isString()) {
								add = "\"" + p.getAsString() + "\"";
							} else if (p.isJsonNull()) {
								add = "null";
							} else {
								Log.w(TAG, "unkown json-type");
								break;
							}
							s += (first ? "" : ",") + add;
							first = false;
						} else {
							Log.w(TAG, "unkown json-type");
						}
					}
					t.addAdditionalEntry(key, s + "]");
				} else {
					Log.w(TAG, "unkown json-type");
				}
			}
		}
		return t;
	}

	public static Task parse_json(JsonObject el, AccountMirakel account) {
		Task t = null;
		JsonElement id = el.get("id");
		if (id != null) {
			t = Task.get(id.getAsLong());
		} else {
			id = el.get("uuid");
			if (id != null) {
				t = Task.getByUUID(id.getAsString());
			}
		}
		if (t == null) {
			t = new Task();
		}
		Set<Entry<String, JsonElement>> entries = el.entrySet();
		for (Entry<String, JsonElement> entry : entries) {
			String key = entry.getKey();
			JsonElement val = entry.getValue();
			if (key == null || key.equals("id")) {
				continue;
			}
			if (key.equals("uuid")) {
				t.setUUID(val.getAsString());
			} else if (key.equals("name") || key.equals("description")) {
				t.setName(val.getAsString());
			} else if (key.equals("content")) {
				String content = val.getAsString();
				if (content == null) {
					content = "";
				}
				t.setContent(content);
			} else if (key.equals("priority")) {
				String prioString = val.getAsString().trim();
				if (prioString.equals("L") && t.getPriority() != -1) {
					t.setPriority(-2);
				} else if (prioString.equals("M")) {
					t.setPriority(1);
				} else if (prioString.equals("H")) {
					t.setPriority(2);
				} else if (!prioString.equals("L")) {
					t.setPriority(val.getAsInt());
				}
			} else if(key.equals("progress")) {
				int progress=(int) val.getAsDouble();
				t.setProgress(progress);
			} else if (key.equals("list_id")) {
				ListMirakel list = ListMirakel.getList(val.getAsInt());
				if (list == null) {
					list = SpecialList.firstSpecial().getDefaultList();
				}
				t.setList(list, true);
			} else if (key.equals("project")) {
				ListMirakel list = ListMirakel.findByName(val.getAsString(),
						account);
				if (list == null
						|| list.getAccount().getId() != account.getId()) {
					list = ListMirakel.newList(val.getAsString(),
							ListMirakel.SORT_BY_OPT, account);
				}
				t.setList(list, true);
			} else if (key.equals("created_at")) {
				t.setCreatedAt(val.getAsString().replace(":", ""));
			} else if (key.equals("updated_at")) {
				t.setUpdatedAt(val.getAsString().replace(":", ""));
			} else if (key.equals("entry")) {
				t.setCreatedAt(parseDate(val.getAsString(),
						context.getString(R.string.TWDateFormat)));
			} else if (key.equals("modification")) {
				t.setUpdatedAt(parseDate(val.getAsString(),
						context.getString(R.string.TWDateFormat)));
			} else if (key.equals("modified")) {
				Calendar modification = new GregorianCalendar();
				modification
						.setTimeInMillis(Long.parseLong(val.getAsString()) * 1000);
				t.setUpdatedAt(modification);
			} else if (key.equals("done")) {
				t.setDone(val.getAsBoolean());
			} else if (key.equals("status")) {
				String status = val.getAsString();
				if (status.equals("pending")) {
					t.setDone(false);
				} else if (status.equals("deleted")) {
					t.setSyncState(SYNC_STATE.DELETE);
				} else {
					t.setDone(true);
				}
				t.addAdditionalEntry(key, "\"" + val.getAsString() + "\"");
			} else if (key.equals("due")) {
				Calendar due = parseDate(val.getAsString(), "yyyy-MM-dd");
				if (due == null) {
					due = parseDate(val.getAsString(),
							context.getString(R.string.TWDateFormat));
					if (due != null) {
						due.setTimeInMillis(due.getTimeInMillis()
								+ TimeZone.getDefault().getRawOffset());
					}
				}
				t.setDue(due);
			} else if (key.equals("reminder")) {
				Calendar reminder = parseDate(val.getAsString(), "yyyy-MM-dd");
				if (reminder == null) {
					reminder = parseDate(val.getAsString(),
							context.getString(R.string.TWDateFormat));
				}
				t.setReminder(reminder);
			} else if (key.equals("annotations")) {
				String content = "";
				try {
					JsonArray annotations = val.getAsJsonArray();
					boolean first = true;
					for (JsonElement a : annotations) {
						if (first) {
							first = false;
						} else {
							content += "\n";
						}
						content += a.getAsJsonObject().get("description")
								.getAsString();
					}
				} catch (Exception e) {
					Log.e(TAG, "cannot parse json");
				}
				t.setContent(content);
			} else if (key.equals("content")) {
				t.setContent(val.getAsString());
			} else if (key.equals("sync_state")) {
				t.setSyncState(SYNC_STATE.parseInt(val.getAsInt()));
			} else if (key.equals("depends")) {
				t.setDependencies(val.getAsString().split(","));
			} else {
				if (val.isJsonPrimitive()) {
					JsonPrimitive p = (JsonPrimitive) val;
					if (p.isBoolean()) {
						t.addAdditionalEntry(key, val.getAsBoolean() + "");
					} else if (p.isNumber()) {
						t.addAdditionalEntry(key, val.getAsInt() + "");
					} else if (p.isJsonNull()) {
						t.addAdditionalEntry(key, "null");
					} else if (p.isString()) {
						t.addAdditionalEntry(key, "\"" + val.getAsString()
								+ "\"");
					} else {
						Log.w(TAG, "unkown json-type");
					}
				} else if (val.isJsonArray()) {
					JsonArray a = (JsonArray) val;
					String s = "[";
					boolean first = true;
					for (JsonElement e : a) {
						if (e.isJsonPrimitive()) {
							JsonPrimitive p = (JsonPrimitive) e;
							String add;
							if (p.isBoolean()) {
								add = p.getAsBoolean() + "";
							} else if (p.isNumber()) {
								add = p.getAsInt() + "";
							} else if (p.isString()) {
								add = "\"" + p.getAsString() + "\"";
							} else if (p.isJsonNull()) {
								add = "null";
							} else {
								Log.w(TAG, "unkown json-type");
								break;
							}
							s += (first ? "" : ",") + add;
							first = false;
						} else {
							Log.w(TAG, "unkown json-type");
						}
					}
					t.addAdditionalEntry(key, s + "]");
				} else {
					Log.w(TAG, "unkown json-type");
				}
			}
		}
		return t;
	}
