var jsonSerializer = function()

in JSLib/src/odata-json.js [279:304]


    var jsonSerializer = function (handler, data, context) {
        /// <summary>Serializes the data by returning its string representation.</summary>
        /// <param name="handler">This handler.</param>
        /// <param name="data">Data to serialize.</param>
        /// <param name="context" type="Object">Object with serialization context.</param>
        /// <returns type="String">The string representation of data.</returns>

        var dataServiceVersion = context.dataServiceVersion || "1.0";
        var useJsonLight = defined(context.useJsonLight, handler.useJsonLight);
        var cType = context.contentType = context.contentType || jsonContentType;

        if (cType && cType.mediaType === jsonContentType.mediaType) {
            var json = data;
            if (useJsonLight || isJsonLight(cType)) {
                context.dataServiceVersion = maxVersion(dataServiceVersion, "3.0");
                json = formatJsonLight(data, context);
                return jsonToString(json);
            }
            if (maxVersion("3.0", dataServiceVersion) === dataServiceVersion) {
                cType.properties.odata = "verbose";
                context.contentType = cType;
            }
            return jsonToString(json);
        }
        return undefined;
    };