* @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)
| 1033 | * @returns {string|undefined} JSON-ified string representing `obj`. |
| 1034 | */ |
| 1035 | function toJson(obj, pretty) { |
| 1036 | if (typeof obj === 'undefined') return undefined; |
| 1037 | if (!isNumber(pretty)) { |
| 1038 | pretty = pretty ? 2 : null; |
| 1039 | } |
| 1040 | return JSON.stringify(obj, toJsonReplacer, pretty); |
| 1041 | } |
| 1042 | |
| 1043 | |
| 1044 | /** |
no test coverage detected