You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var msg = new SendGridMessage();
var serializerSettings = new Newtonsoft.Json.JsonSerializerSettings
{
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
msg.SetTemplateData(dynamicTemplateData, serializerSettings);
Current options are far too restrictive, I can only see that decorating properties with JsonProperty has any type of effect.
Also, I'm sure this test is simply testing Newtonsofts lib.
Pull requests to add this feature are welcome and will be reviewed based on priority, but Twilio SendGrid is not actively building new functionality for the library.
Over an year now and still no support to native .net serializer...
Aren't these client libraries supposed to supported by Twilio? There is even a PR just sitting there and really no real effort to make it happen. 3 days for now .net 2.1 end of support is there and this will not have happened.
Basically, we take the current template data (deserialized with STJ, so it has JsonElement and friends), serialize it to plain JSON, then deserialize that using Newtonsoft.Json to get the proper dynamic JSON types (JToken and friends).
Had to employ the same ugly and ineffective solution @Sharparam .
It's funny how they put it in the home page as they want this library to be community driven. But someone comes, makes all the effort (a lot of effort), keeps it updated, follow the guidelines and after almost an entire year and the pull request is still there:
Don't think there is enough respect to the effort being made there. And this will never be community driven when there is a gatekeeper acting as a bottleneck for community driven work.
If anybody is still waiting for a solution to customize how you dynamic template data is serialized, I suggest you have a look at StrongGrid which is an alternative to SendGrid's client (disclaimer: I'm the author). StrongGrid allows you to specify your own serialization options, including the naming policy.
Activity
eshanholtz commentedon Mar 24, 2020
Pull requests to add this feature are welcome and will be reviewed based on priority, but Twilio SendGrid is not actively building new functionality for the library.
shervinw commentedon Mar 26, 2020
More than happy to do so! Following all guidelines!
Looking at open pull requests, may I ask the time it may take to merge this functionality?
tunminster commentedon Sep 28, 2020
@shervinw @eshanholtz Not sure if the pull request is already there? we have bumped into this with .net 5. #1050
childish-sambino commentedon Sep 29, 2020
No PRs yet, but they are welcome!
fabio-s-franco commentedon Aug 18, 2021
Over an year now and still no support to native .net serializer...
Aren't these client libraries supposed to supported by Twilio? There is even a PR just sitting there and really no real effort to make it happen. 3 days for now .net 2.1 end of support is there and this will not have happened.
vdurante commentedon Nov 26, 2021
+1
kshyju commentedon Jan 20, 2022
@eshanholtz Does this mean that there will not be a version of this library with System.Text.Json support? Currently some of the types has a strong dependency on JSON.NET.
Asking it here because1050 was closed as it was marked as dupe of this. Thanks!
Sharparam commentedon Feb 28, 2022
Would be good with some updates on this. We're hitting this as an issue as well when replacing Newtonsoft.Json with System.Text.Json.
Most other libraries have a way to set a custom serializer which lets us configure them properly, but this library does not.
Is development on this project stopped which means Twilio is no longer supplying an official C#/.NET SDK?
Edit: As an ugly workaround, since we only seem to have issues with
TemplateData
.Basically, we take the current template data (deserialized with STJ, so it has
JsonElement
and friends), serialize it to plain JSON, then deserialize that using Newtonsoft.Json to get the proper dynamic JSON types (JToken
and friends).fabio-s-franco commentedon Mar 3, 2022
Had to employ the same ugly and ineffective solution @Sharparam .
It's funny how they put it in the home page as they want this library to be community driven. But someone comes, makes all the effort (a lot of effort), keeps it updated, follow the guidelines and after almost an entire year and the pull request is still there:
#1110
Don't think there is enough respect to the effort being made there. And this will never be community driven when there is a gatekeeper acting as a bottleneck for community driven work.
Jericho commentedon Apr 25, 2022
If anybody is still waiting for a solution to customize how you dynamic template data is serialized, I suggest you have a look at StrongGrid which is an alternative to SendGrid's client (disclaimer: I'm the author). StrongGrid allows you to specify your own serialization options, including the naming policy.
Hope this helps.