Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
FYI, if you're developing an app in ASP.NET. ASP.NET considers JSON keys with the same name, but different casing, to be duplicate and will throw an error. So in the case of receiving an Order Update webhook call, and if that order has a refund transaction, it may have duplicate keys that will throw an error.
In our example, the duplicate keys specifically were in the following path:
order,refunds,0,transactions,0,receipt,version
order,refunds,0,transactions,0,receipt,timestamp
order,refunds,0,transactions,0,receipt,ack
order,refunds,0,transactions,0,receipt,build
These keys exist in the same Receipt json object and exist in both all lowercase and in TitleCase. It's redundant, ambiguous, and not friendly to ASP.NET development partners. As such, I've submitted a support email to this affect in hopes they will fix it.
However, if you need to create a work around, you can check out this StackOverflow post.
Hope this helps save some other partner hours of time trying to figure out this problem 🙂
Ahh, a holdover from the Microsoft Windows paradigm. Of not observing the most traditional practices of case sensitivity. I do recall running into this awhile back. It's a shame that the JSON RFC (https://tools.ietf.org/html/rfc4627) was worded:
2.2. Objects
An object structure is represented as a pair of curly brackets surrounding zero or more name/value pairs (or members). A name is a string. A single colon comes after each name, separating the name from the value. A single comma separates a value from a following name. The names within an object SHOULD be unique.
SHOULD be unique versus MUST ALWAYS be unique. Definitely a gotcha. Good reminder!