Skip to content

Allow a way to serialize/deserialize downloaded dataΒ #195

@xavierpena

Description

@xavierpena

(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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions