# angular.toJson

Work in Progress This page is currently being revised. It might be incomplete or contain inaccuracies.

## Description

Serializes the input into a JSON formated string.

## Usage

    angular.toJson(obj[, pretty]);

### Parameters

- `obj – {Object|Array|Date|string|number} –`

  Input to jsonify.

- `pretty(optional) – {boolean} –`

  If set to true, the JSON output will contain newlines and whitespace.

### Returns

`{string}` –

Jsonified string representing `obj`.