@SuppressWarnings("unchecked")
	public static LinkedHashMap<String,Object> objectToArray(Object object) {
		LinkedHashMap<String,Object> data= new LinkedHashMap<String,Object>();
		if (object == null) return data;

		if (Functions.method_exists(object,"toArray")) {
			Object retObj = Functions.call_method(object,"toArray");
			if (retObj instanceof LinkedHashMap) return (LinkedHashMap<String,Object>) retObj;
		}

		Map<String,Object> vars = Functions.get_object_vars(object);
		for (Map.Entry<String,Object> entry: vars.entrySet()) {
			String key = (String) entry.getKey();
			Object value = (Object) entry.getValue();
			if (value instanceof Map) {
				Map<String,Object> valueMap = (Map<String,Object>) value;
				data.put(key,Functions.processArray(valueMap));
			} else if (Functions.is_string(value)) {
				data.put(key,value);
			} else if (Functions.is_object(value)) {
				if (!Functions.method_exists(value,"toArray")) {
					data.put(key,Functions.objectToArray(value));
				} else {
					Object retObj = Functions.call_method(value,"toArray");
					if (retObj instanceof LinkedHashMap) data.put(key, (LinkedHashMap<String,Object>) retObj);
				}
			} else {
				data.put(key,value);
			}
		}
		return data;
	}