Aria Templates Forums
asyncRequest retrieves JSON as plain text - Printable Version

+- Aria Templates Forums (http://ariatemplates.com/forum)
+-- Forum: Public forums (/forumdisplay.php?fid=3)
+--- Forum: Support (/forumdisplay.php?fid=8)
+--- Thread: asyncRequest retrieves JSON as plain text (/showthread.php?tid=189)



asyncRequest retrieves JSON as plain text - nicolast - 4 March 2014 18:01

Hello,

When making a GET request that returns a JSON file, using aria.core.IO.asyncRequest, the JSON content is placed in the responseText property of the response object, instead of responseJSON.

I checked the http response, and the file is actually served with the application/json content-type.

Could that be an Aria Templates bug?

Thank you!


RE: asyncRequest retrieves JSON as plain text - jakub-g - 5 March 2014 15:57

Hi @nicolast,

On your request object, you should put "expectedResponseType" : "json"

http://ariatemplates.com/aria/guide/apps/apidocs/#aria.core.CfgBeans:IOAsyncRequestCfg

(not all the properties of the request are documented inline in the http://ariatemplates.com/aria/guide/apps/apidocs/#aria.core.IO:asyncRequest:method jsdoc). This is important enough though to be included there - thanks for the report.

Let us know if this solved the issue!


RE: asyncRequest retrieves JSON as plain text - nicolast - 5 March 2014 16:10

It actually solved the issue, thank you!


RE: asyncRequest retrieves JSON as plain text - jakub-g - 5 March 2014 17:36

Cool, thanks for feedback Smile