Giter Club home page Giter Club logo

Comments (6)

Jericho avatar Jericho commented on June 19, 2024 1

@elmalakai here's a beta version of the next package that will properly serialize uniqueargs: https://www.myget.org/feed/jericho/package/nuget/StrongGrid/0.101.0-beta0005

The only concession we have to make is that unique arguments with a numerical value will be serialized as a string like so:

"reseller_id": "1234"

which is not 100% same as the original JSON received from SendGrid but it's the best we can do due to the fact that unknown values must be cast as string in order to be added to the Dictionary<string, string>.

from stronggrid.

elmalakai avatar elmalakai commented on June 19, 2024

I struggle with this a lot in dealing with JSON everywhere. Lately I use Dictionary<string,object> and use one of the many System.Text.Json 'generic' object converters out there to store the value as strongly typed (double, bool, null, string, array).

I think for now, treating all unique arguments as strings is acceptable. Most of these arguments you add yourself to the message, so you know best how to parse and deal with them.

from stronggrid.

Jericho avatar Jericho commented on June 19, 2024

Thanks for confirming.

from stronggrid.

elmalakai avatar elmalakai commented on June 19, 2024

Looks like you had an bug in 0.101.0-beta0005 but I think you've fixed it. I tried to write a test case for it and it's working. Specifically, the UniqueArguments were being double wrapped in double quotes when deserialized:

? events[0].UniqueArguments["environment"]
"\"Production\""

Tried to write a test case for it, but I think you beat me to it (Webhook_includes_unknow_property).

from stronggrid.

Jericho avatar Jericho commented on June 19, 2024

Yes, I confirm there was an issue with quotes being doubled but fixed it here: 04ba8b2#diff-bbf883778fe4acba4cb2d3272c16d800f7dcc6fcbf69c03f9415607d4af110fdR115

Using .GetRawText() to get the content of a JSON node containing a string includes the double quotes evidently (I didn't know). It's not a problem with nodes containing numerical values though.

from stronggrid.

Jericho avatar Jericho commented on June 19, 2024

🎉 This issue has been resolved in version 0.101.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

from stronggrid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.