* @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 {Obje
(obj, pretty)
| 1235 | * @returns {string|undefined} JSON-ified string representing `obj`. |
| 1236 | */ |
| 1237 | function toJson(obj, pretty) { |
| 1238 | if (isUndefined(obj)) return undefined; |
| 1239 | if (!isNumber(pretty)) { |
| 1240 | pretty = pretty ? 2 : null; |
| 1241 | } |
| 1242 | return JSON.stringify(obj, toJsonReplacer, pretty); |
| 1243 | } |
| 1244 | |
| 1245 | /** |
| 1246 | * @ngdoc function |
no test coverage detected