src/sap.ui.core/src/sap/ui/model/odata/_AnnotationHelperBasics.js
function (vValue) {
			var sStringified,
				bEscaped = false,
				sResult = "",
				i, c;

			sStringified = JSON.stringify(vValue);
			if (sStringified === undefined) {
				return undefined;
			}
			for (i = 0; i < sStringified.length; i += 1) {
				switch (c = sStringified.charAt(i)) {
					case "'": // a single quote must be escaped (can only occur in a string)
						sResult += "\\'";
						break;
					case '"':
						if (bEscaped) { // a double quote needs no escaping (only in a string)
							sResult += c;
							bEscaped = false;
						} else { // string begin or end with single quotes
							sResult += "'";
						}
						break;
					case "\\":
						if (bEscaped) { // an escaped backslash
							sResult += "\\\\";
						}
						bEscaped = !bEscaped;
						break;
					default:
						if (bEscaped) {
							sResult += "\\";
							bEscaped = false;
						}
						sResult += c;
				}
			}
			return sResult;
		}
function (vValue) {
			var sStringified,
				bEscaped = false,
				sResult = "",
				i, c;

			sStringified = JSON.stringify(vValue);
			if (sStringified === undefined) {
				return undefined;
			}
			for (i = 0; i < sStringified.length; i += 1) {
				switch (c = sStringified.charAt(i)) {
					case "'": // a single quote must be escaped (can only occur in a string)
						sResult += "\\'";
						break;
					case '"':
						if (bEscaped) { // a double quote needs no escaping (only in a string)
							sResult += c;
							bEscaped = false;
						} else { // string begin or end with single quotes
							sResult += "'";
						}
						break;
					case "\\":
						if (bEscaped) { // an escaped backslash
							sResult += "\\\\";
						}
						bEscaped = !bEscaped;
						break;
					default:
						if (bEscaped) {
							sResult += "\\";
							bEscaped = false;
						}
						sResult += c;
				}
			}
			return sResult;
		}
function ( vValue ) { var sStringified , bEscaped = false , sResult = "" , i , c ; sStringified = JSON . stringify ( vValue ) ; if ( sStringified === undefined ) { return undefined ; } for ( i = 0 ; i < sStringified . length ; i += 1 ) { switch ( c = sStringified . charAt ( i ) ) { case "'" : // a single quote must be escaped (can only occur in a string) sResult += "\\'" ; break ; case '"' : if ( bEscaped ) { // a double quote needs no escaping (only in a string) sResult += c ; bEscaped = false ; } else { // string begin or end with single quotes sResult += "'" ; } break ; case "\\" : if ( bEscaped ) { // an escaped backslash sResult += "\\\\" ; } bEscaped = ! bEscaped ; break ; default : if ( bEscaped ) { sResult += "\\" ; bEscaped = false ; } sResult += c ; } } return sResult ; }
Converts the value to a JSON string. Prefers the single quote over the double quote.
This suits better for usage in an XML attribute.

@param {any} vValue the value
@returns {string} the stringified value
Converts the value to a JSON string . Prefers the single quote over the double quote . This suits better for usage in an XML attribute .