RedditSharp-DEPRECATED-
RedditSharp-DEPRECATED- copied to clipboard
Allow a way to serialize/deserialize downloaded data
(in the 2.0-.Net.Core
branch)
Example:
- You download a
Post
- You want to persist that
Post
in disk (because for example you are testing something and you don't want to retrieve it from the internet at every time) - You serialize it via Newtonsoft.Json, and you persist it in disk
When you try to deserialize this json you find several issues:
- In the props that include
UnixTimestampConverter
, the converter expects an Int64 as an input. The serialized json contains a DateTime. - You cannot bypass
WebAgent
, you should inject it via dependency injection instead.
The simplest solution that I have found is: making the RawJson
(the JToken
) public in Thing
(link to the line of code). I can then access Post.RawJson
(or on any other Thing
) and serialize it, and then deserialize it via new Post(webAgent, rawJson)
.
Would you consider making this property public? It would be really helpful.
Looking forward to your feedback.
Yeah I don't have any specific issues with making that public. I've been swamped at work (still) but if you want to send in a pull request, I'll accept it