Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Bug in AIR - JSON?

Guest
Jul 16, 2013 Jul 16, 2013

I am reading from, and sending to a web-service that uses JSON. Last night I wrote a little test code to get the authentication token from the service. If I publish to Flash Player 11.2 then it works fine. In Charles, the web debugger, I see the JSON object returned, and can parse it without issue in Flash.

Without _any_ code changes, I publish to AIR 3.2 for Desktop and I get a JSON error about not being able to parse key value pairs. In Charles I see that the returned object is now XML and not JSON. I'm going to need to ask the service provider wht might make the service return XML, but was wondering it anyone had seen this before, and if there's any kind of fix.

TOPICS
ActionScript
517
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 16, 2013 Jul 16, 2013
LATEST

I got it worked out. Maybe I wouldn't call it a bug, but it's a definite difference in how FlashPlayer and AIR behave.

So, the fix was to add an Accept 'application./json' header to the request when using AIR. Flash player must do this automatically.

var hdr:URLRequestHeader = new URLRequestHeader("Accept", "application/json");

request.requestHeaders.push(hdr);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines