cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

JSON API Response ERROR

While whipping up some code to directly use the API, I spent some time sussing out why the JSON response was crashing things. Turns out it's because it is returning a UTF-8+BOM character encoded string, which it definitely should not. As written in the RFC:

 

"Implementations MUST NOT add a byte order mark to the beginning of a JSON text"
(https://tools.ietf.org/html/rfc7159#section-8.1)

 
When coming here to make this post, I looked around in the forums and (almost) got excited when I saw this thread:
https://community.developer.authorize.net/t5/News-and-Announcements/Important-JSON-API-Response-Chan...

But that excitement quickly vanished when I read that it was decided to NOT implement the fix. I would strongly encourage you to revert that decision, and actually DO implement the prescribed fix as your current implementation is not RFC compliant.

 

Making the decision to NOT adhere to RFC standards just doesn't make sense, and costs developers untold (combined) hours of unnecessary troubleshooting time. PLEASE re-discuss this decision internally, and (hopefully) come down on the side to have your API conform to the RFC standards.

For those that have come across this headache, here's a workaround for it, that *shouldn't* need to be done, but will work until A.net decides to make the change away from UTF-8+BOM.

$tmp_bom = pack('H*','EFBBBF');
$result = preg_replace("/^$tmp_bom/", '', $result);
unset($tmp_bom);
$result = json_decode($result);
jima
Regular Contributor
Who Me Too'd this topic