Xrm.Tools.CRMWebAPI
Xrm.Tools.CRMWebAPI copied to clipboard
Add support for JsonSerializationSettings
Hello! Currently there's no straightforward way to customize json serialization process for this package. Can you add it? Thank you!
Can you elaborate on the scenario you are trying to solve?
Shure! The crm project I'm working in has really badly named fields, and I want my dto objects to have nicer names. Also I want the dtos clients get using the library to serialize to json normally, so using JsonProperty or other standart attributes is out of the question. I figured out I could write custom attributes and contract resolver, but I need to supply that in serialization settings. Hope that makes sence. Thanks!
ok I see, now I didn't look to hard at this, but take a look at http://blog.maskalik.com/asp-net/json-net-implement-custom-serialization/ - I believe Get<> and GetList<> would let you provide your own class, if you attribute it as this blog post indicated it looks like it would let your custom serializer do the work - disclaimer I didn't dig in too deep on the article - let me know if that gets you toward what you are trying to accomplish
That won't do - it's the same as using JsonProperty attributes. I want to have a special kind of json serialization just for the crm, and let the classes work normally with other json serialization cases, but decorating property or a class with json attributes will apply them globally.
So what changes to the API would you like to see?
I think API-wise the best thing will be ability to set JsonSerializationSettings for CRMWebAPI object.