Order Webhook JSON Duplicate Keys

MozzoERP
Shopify Partner
84 4 20

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.

2021-02-25 13_09_42-InvalidOrderJson.jpg

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 🙂

Chad Richardson
Mozzo Software - Modular Software that grows with you from solopreneur to a 200 person mega team. Why keep outgrowing your Shopify Apps? Start with us, and just use the modules you need, then add more as you grow. http://MozzoERP.com
Reply 1 (1)

Gregarican
Shopify Partner
1033 86 285

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!