Improve this doc View Source

Serializes input into a JSON-formatted string. Properties with leading $ characters will be stripped since angular uses this notation internally.

## Usage

`angular.toJson(obj, [pretty]);`

### Arguments

Param | Type | Details
--- | --- | ---
obj | ObjectArrayDatestringnumber | Input to be serialized into JSON.
pretty (optional) | boolean | If set to true, the JSON output will contain newlines and whitespace.

### Returns

stringundefined | JSON-ified string representing `obj`.