rikimaru0345 / Ceras

Universal binary serializer for a wide variety of scenarios https://discord.gg/FGaCX4c
MIT License
484 stars 53 forks source link

Serialize object graph down to the certain depth #84

Open cemmerven opened 4 years ago

cemmerven commented 4 years ago

Like Newtonsoft's Json serializer, serializing object graph to the certain depth may be useful in some use cases like O/R Mappers. (P.S. newtonsoft is actually limit depth while deserializing but not serializing). Stack overflow json.net limit maxdepth when serializing discussion is a good example of such scenario.

rikimaru0345 commented 4 years ago

There are settings to limit the maximum number of elements in collections, max length of strings, etc.. everything that is dynamic. Except for "depth", there's no setting for that yet. I guess it could be added into the ReferenceFormatter pretty easily, just increase/decrease a value in ceras.InstanceData...

Unfortunately I don't have any time currently to work on this.