Skip to content

Serializing with JSON #38

@msant7

Description

@msant7

Hi, I was wondering if anyone had any thoughts about serializing with JSON instead of BinaryFormatter. I implemented the following as a test on my local dev and it seems to work well:
https://patrickdesjardins.com/blog/serializing-complex-object-for-redis

PROS

  • The big PRO is that you don't have to add and maintain [Serializable] to all your classes being cached in Redis.
    CONS
  • Small size increase, could compress but obviously adds overhead
  • It won't honor [NonSerialized] attributes, but I guess it would honor [JsonIgnore] attributes
  • It could be potentially easier for someone to inject a "Bad" object in the cache since the type is included in the cached object.

Here is an example of a cached item...

get dma9_DNN_SkinDefaults_SkinInfo
"{\r\n "$id": "1",\r\n "$type": "DotNetNuke.UI.Skins.SkinDefaults, DotNetNuke",\r\n "AdminDefaultName": "Admin.ascx",\r\n "DefaultName": "Inner.ascx",\r\n "Folder": "/Xcillion/"\r\n}"

Just curious if anyone has any thoughts on this or have tried this with DNN. Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions