You should probably be ensuring that your `accept` header includes, or is exclusively, `application/json` here.  Otherwise the server might send back arbitrary other formats that don't contain what you expect.  Given the type-dependent name of the function, doing that here seems the most reasonable choice.  (After all, the caller expressed a clear expectation they would be decoding JSON already. :)