View source Improve this doc

angular.toJson

API in module ng

Description

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

Usage

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

Parameters

ParamTypeDetails
objObjectArrayDatestringnumber Input to be serialized into JSON.
pretty (optional) boolean If set to true, the JSON output will contain newlines and whitespace.

Returns

string|undefined JSON-ified string representing obj.