* @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)
| 1320 | * See https://github.com/angular/angular.js/pull/14221 for more information. |
| 1321 | */ |
| 1322 | function toJson(obj, pretty) { |
| 1323 | if (isUndefined(obj)) return undefined; |
| 1324 | if (!isNumber(pretty)) { |
| 1325 | pretty = pretty ? 2 : null; |
| 1326 | } |
| 1327 | return JSON.stringify(obj, toJsonReplacer, pretty); |
| 1328 | } |
| 1329 | |
| 1330 | |
| 1331 | /** |
no test coverage detected