Added Base64 decoding if JSON is expected.