* @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|boolean}
(obj, pretty)
| 1444 | * See https://github.com/angular/angular.js/pull/14221 for more information. |
| 1445 | */ |
| 1446 | function toJson(obj, pretty) { |
| 1447 | if (isUndefined(obj)) return undefined; |
| 1448 | if (!isNumber(pretty)) { |
| 1449 | pretty = pretty ? 2 : null; |
| 1450 | } |
| 1451 | return JSON.stringify(obj, toJsonReplacer, pretty); |
| 1452 | } |
| 1453 | |
| 1454 | |
| 1455 | /** |
no test coverage detected