* @ngdoc function * @name angular.toJson * @module ng * @kind function * * @description * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be * stripped since angular uses this notation internally. * * @param {Object|Array|Date|string|number} obj Inp
(obj, pretty)
| 1259 | * @returns {string|undefined} JSON-ified string representing `obj`. |
| 1260 | */ |
| 1261 | function toJson(obj, pretty) { |
| 1262 | if (isUndefined(obj)) return undefined; |
| 1263 | if (!isNumber(pretty)) { |
| 1264 | pretty = pretty ? 2 : null; |
| 1265 | } |
| 1266 | return JSON.stringify(obj, toJsonReplacer, pretty); |
| 1267 | } |
| 1268 | |
| 1269 | |
| 1270 | /** |
no test coverage detected