Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
For simplicity's sake lets make it always an object: Properties firstOfTwo and secondOfTwo for exactly two SKUs.
Properties first, middle, last for three SKUs.
For more than three SKUs:
Properties like for two to three SKUs, but the values are objects of SKUs like outlined above.
This tree structure should be able to accomodate any amount of SKUs there could possibly be.
No need to thank me or pay royalties, i am known for my straightforward and simple data structures and am happy to help. -
Some JSON serializers behave this way by default. I'm guessing that's why you're getting this mess - devs were too lazy to reconfigure the serializer.
I can't point a finger, but I'm 100% certain I've been bit by that myself. From the API developer's perspective (i.e. I was returning {} if only 1 item, and {}[] if multiple). Then I found I can disable this nonsense... I *think* it had something to do with Spring and whatever serializer it was using in that version -
I have worked with similar company issues. Only for me the variable names were slightly different for each API call, eg. companyID, compId, CompID, Companyid, company_id
-
@ojt-rant
"We have two company ID properties.
The first contains the company ID formatted as bitmap with prerendered glow ready for display on the page.
The second contains the company ID hashed for use as a search key." -
@Oktokolo not to be confused with the "company" DB table, of course....company.id :)
Company A (mine) is building a site for company B, company B employs company C to manage their inventory database, company C exports inventory as JSON to company A, company C says, this field (SKUs) will be an object (skus = {...}) when it only has 1 value, but an array (skus = [{}, {}, ...]) when there are multiple SKUs, company A (me) tells company B to tell company C to ensure it's always an array.... company B is scared of company C and company A (me) is always cleaning up company C's shit
rant
company c
company a
company b