我有一个处理 HelloSign 回调事件的 API。我进入Stream
请求数据。我将其转换Stream
为String
使用以下代码,它为我提供了以下字符串。
public bool HSEventCallback(Stream stream)
{
bool callbackStatus = false;
try
{
StreamReader reader = new StreamReader(stream);
string text = reader.ReadToEnd();
callbackStatus = true;
}
catch (Exception ex)
{
callbackStatus = false;
}
return callbackStatus;
}
结果
------------------5sdf54df6a5s4df6 内容配置:表单数据;名称="json"
{"event":{"event_type":"callback_test","event_time":"514651651","event_hash":"65a65adsxv34adsv514dv6514v6s584v6a5v46a5sv46sd5v146v54s6av4s6av54ds6v46av","event_metadata":{"related_signature_id":null,"reported_for_account_id":"564as4df65a4f65sd4f65sad4f6sad5f46sdf54s6df54","报告_for_app_id":null,"event_message":null}}} ------------------------------5sdf54df6a5s4df6--
谁能建议我如何反序列化上面的字符串。我可以通过替换一些文本和创建“事件”类来反序列化。但我不知道它是否适用于所有类型的数据。
请建议反序列化上述字符串的标准方法。