src/aria/core/IO.js
function (response, expectedResponseType) {
            if (expectedResponseType == "text") {
                if (!response.responseText && response.responseJSON != null) {
                    // convert JSON to text
                    if (ariaUtilsType.isString(response.responseJSON)) {
                        // this case is important for JSON-P services which return a simple string
                        // we simply use that string as text
                        // (could be useful to load templates through JSON-P, for example)
                        response.responseText = response.responseJSON;
                    } else {
                        // really convert the JSON structure to a string
                        response.responseText = ariaUtilsJson.convertToJsonString(response.responseJSON);
                    }
                }
            } else if (expectedResponseType == "json") {
                if (response.responseJSON == null && response.responseText != null) {
                    // convert text to JSON
                    var errorMsg = (require("../utils/String")).substitute(this.JSON_PARSING_ERROR, [response.url,
                            response.responseText]);
                    if (response.responseText === "") {
                        var undef;
                        response.responseJSON = undef;
                    } else {
                        response.responseJSON = ariaUtilsJson.load(response.responseText, this, errorMsg);
                    }
                }
            }

        }
function (response, expectedResponseType) {
            if (expectedResponseType == "text") {
                if (!response.responseText && response.responseJSON != null) {
                    // convert JSON to text
                    if (ariaUtilsType.isString(response.responseJSON)) {
                        // this case is important for JSON-P services which return a simple string
                        // we simply use that string as text
                        // (could be useful to load templates through JSON-P, for example)
                        response.responseText = response.responseJSON;
                    } else {
                        // really convert the JSON structure to a string
                        response.responseText = ariaUtilsJson.convertToJsonString(response.responseJSON);
                    }
                }
            } else if (expectedResponseType == "json") {
                if (response.responseJSON == null && response.responseText != null) {
                    // convert text to JSON
                    var errorMsg = (require("../utils/String")).substitute(this.JSON_PARSING_ERROR, [response.url,
                            response.responseText]);
                    if (response.responseText === "") {
                        var undef;
                        response.responseJSON = undef;
                    } else {
                        response.responseJSON = ariaUtilsJson.load(response.responseText, this, errorMsg);
                    }
                }
            }

        }
function ( response , expectedResponseType ) { if ( expectedResponseType == "text" ) { if ( ! response . responseText && response . responseJSON != null ) { // convert JSON to text if ( ariaUtilsType . isString ( response . responseJSON ) ) { // this case is important for JSON-P services which return a simple string // we simply use that string as text // (could be useful to load templates through JSON-P, for example) response . responseText = response . responseJSON ; } else { // really convert the JSON structure to a string response . responseText = ariaUtilsJson . convertToJsonString ( response . responseJSON ) ; } } } else if ( expectedResponseType == "json" ) { if ( response . responseJSON == null && response . responseText != null ) { // convert text to JSON var errorMsg = ( require ( "../utils/String" ) ) . substitute ( this . JSON_PARSING_ERROR , [ response . url , response . responseText ] ) ; if ( response . responseText === "" ) { var undef ; response . responseJSON = undef ; } else { response . responseJSON = ariaUtilsJson . load ( response . responseText , this , errorMsg ) ; } } } }
Convert the response text into Json or response Json into text
@param {aria.core.CfgBeans:IOAsyncRequestResponseCfg} response Response object
@param {String} expectedResponseType The expected response type
@protected
Convert the response text into Json or response Json into text