/// serialize any object. depending on the type of the object, it will be serialized in binary format static public string SerializeObjectWithType(object o) { if (o == null) { return("null:void"); } bool binary = ShouldParameterEncodeBinary(o); string result = SerializeObject(o, binary); if (THttpBinarySerializer.isJSClient()) { if ((result.Length > 0) && (result[0] != '{') && (result[0] != '[')) { result = "\"" + result + "\""; } return(result); } // fat client if (result.EndsWith(":binary")) { return(result); } else { return(result + ":" + (binary ? "binary" : o.GetType().ToString())); } }
/// <summary> /// serialize any object. if it is a complex type, use JSON or Base64 (fat client) /// </summary> static public string SerializeObject(object o, bool binary) { return(THttpBinarySerializer.isJSClient() ? SerializeObjectJSON(o, binary) : SerializeObjectBase64(o, binary)); }
/// <summary> /// serialize any object. if it is a complex type, use JSON or Base64 (fat client) /// </summary> static public string SerializeObject(object o) { return(THttpBinarySerializer.isJSClient() ? SerializeObjectJSON(o) : SerializeObjectJSON(o).Trim('"')); }