/// <reference path="IResponseReader.ts" />
/// <reference path="../../util/Json.ts"/>
var econda;
(function (econda) {
    var ajax;
    (function (ajax) {
        var reader;
        (function (reader) {
            /**
             * Reader for json xhr responses. Converts json text to an object structure. Do not use
             * this class directly. See {@link econda.ajax.Request#reader} for details.
             * @class econda.ajax.reader.JsonReader
             */
            var JsonReader = (function () {
                function JsonReader() {
                }
                /**
                 * Read and convert response
                 * @method
                 * @param {String} xhrResponse
                 * @returns {Object}
                 */
                JsonReader.prototype.read = function (xhrResponseText) {
                    var response = null;
                    if (xhrResponseText) {
                        try {
                            response = econda.util.Json.parse(xhrResponseText);
                        }
                        catch (error) {
                            response = null;
                        }
                    }
                    return response;
                };
                return JsonReader;
            }());
            reader.JsonReader = JsonReader;
        })(reader = ajax.reader || (ajax.reader = {}));
    })(ajax = econda.ajax || (econda.ajax = {}));
})(econda || (econda = {}));