I have an API which handles call back event of HelloSign. I get Stream
in the request data. I convert that Stream
into String
using following code and it provide me following 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;
}
Result
------------------------------5sdf54df6a5s4df6 Content-Disposition: form-data; name="json"
{"event":{"event_type":"callback_test","event_time":"514651651","event_hash":"65a65adsxv34adsv514dv6514v6s584v6a5v46a5sv46sd5v146v54s6av4s6av54ds6v46av","event_metadata":{"related_signature_id":null,"reported_for_account_id":"564as4df65a4f65sd4f65sad4f6sad5f46sdf54s6df54","reported_for_app_id":null,"event_message":null}}} ------------------------------5sdf54df6a5s4df6--
Can anybody please suggest me how to de serialize above string. I can deserialize by replacing some of text and by creating class of `event'. But I don't know whether it will work for all kind of data.
Please suggest standard way to deserialize above string.