You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Had an issue with returned data for an item I tracked. Usually I get multiple detail records back in the trackDetail property as an array (typeof "object"). However, I tracked an item that had only one trackDetail record and the property was typeof "string" which caused an issue as I was using shift() to step through the records. While it is simple enough to check the property type and handle it accordingly, I think the property should always be returned as an array even if it contains only one element. In my, case it was only a half hour before the postal service added another detail entry and the property became an array.
This is JSON that was returned. First is for the single record:
"trackInfo": {
"trackSummary": "Your item arrived at the Post Office at 11:41 am...",
"trackDetail": "Arrived Shipping Partner Facility, USPS Awaiting Item, February 8, 2019, ..."
}
Multiple records:
"trackInfo": {
"trackSummary": "Your item arrived at the Post Office at 11:41 am...",
"trackDetail": [
"Accepted at USPS Destination Facility, February 8, 2019, 10:26 am, ...",
"Arrived Shipping Partner Facility, USPS Awaiting Item, February 8, 2019, ..."
]
}
The text was updated successfully, but these errors were encountered:
Had an issue with returned data for an item I tracked. Usually I get multiple detail records back in the trackDetail property as an array (typeof "object"). However, I tracked an item that had only one trackDetail record and the property was typeof "string" which caused an issue as I was using shift() to step through the records. While it is simple enough to check the property type and handle it accordingly, I think the property should always be returned as an array even if it contains only one element. In my, case it was only a half hour before the postal service added another detail entry and the property became an array.
This is JSON that was returned. First is for the single record:
Multiple records:
The text was updated successfully, but these errors were encountered: