14
irene
4y

{ “dow”: “10000001,10000002” }

Me: So what does this mean in the JSON response and why isn’t it a JSON collection?
Dynamics guys: that represents the days of the week. Because that is how it comes out of Microsoft Dynamics.

I’m thinking that they are either bad rest API programmers MS is bad at JSON. I can’t see the code so I don’t know which. No fixes because budget.

Comments
  • 4
    😞such wrong, much bad, comma seperated values as a string as a collection.... how did that ever get to production.
  • 4
    Knowing Microsoft, the first tuple object the is an an array of bool as a string if the day in enabled, the second tuple object is the “days of the week” enum in array as a string so “Monday, six Sundays, Tuesday”with the tuple itself being a string. But not knowing the endpoint makes this a wild guess.
  • 3
    I'm really trying to see possible ways how to explain this, be a good cop and justify them, but as it looks like I simply can't..
  • 3
    APIs are not just wrappers for another service, just like designers aren't photoshop styli that understand english!
  • 1
    That's hella bad.
  • 1
    @Root True, but Microsoft, IBM, and SAP usually just wrap c-style functions.
  • 4
    @bkwilliams Just because a large corporation or project does smething wrong doesn't mean you should, too.
  • 2
    @bkwilliams This particular one could also be represented like this.

    {“sunday”:false,“monday”:true,”tuesday”:true,”wednesday”:false,”thursday”:false,”friday”:false,”saturday”:false}
  • 1
    @C0D4 Italians: comma separation? Here we go 💪
  • 0
    Who ever wrote that shit should be sent to an asylum for long time treatment.....
  • 0
    @irene And now imagine thousands of rows: What a waste of traffic and longer serialization / deserialization times. Sometimes there is a reason. I don’t know if there is one for this case, but might be
  • 1
    @NoToJavascript

    These ""shortcuts"' aka let's compact till it gets ridiculous... Are wrong. You don't win.

    When I read Irene's comment, you could use ISO representation, 1 for monday, 7 for sunday.

    You'd have two TINYINT's, each tinyint costs 1 byte, total 2 bytes.

    Beats every string storage.

    Can be used as a JOIN table, allowing efficient index usage.

    Even when not using a database, packing the stuff as an ENUM or ENUM like representation makes way more sense than an unreadable string....
  • 0
    dynamics guy here. if i get this correct the values are optionset values representing a day each originating from some record‘s multi-option-field and that’s indeed how it‘s presented in the web API. no way to influence this unfortunately.
Add Comment