I'm using Newtonsoft 开发者_JAVA技巧JSON.NET library, but run into following problem.
Dynamic serialization iterates over all object properties and fields. But when using eg ORM where dynamic proxying comes in, I've got obviously error that proxy internal fields can't be serialized.
Using attributes on serialized classes with OptIn approach is not an option. Classes are used not only for web app, and dependency for JSON.NET assemblies is not possible.
Any suggestion for approach with minimum binding/wiring code?
You could define your json-format in a seperate set of classes and convert the ORM-classes to these with eg. Automapper.
精彩评论