angular.filter.json

Usage

In HTML Template Binding

{{ object_expression | json }}

In JavaScript

angular.filter.json(object);

Parameters

Returns

{string} JSON string.

CSS

ng-monospace Always applied to the encapsulating element.

Description

Allows you to convert a JavaScript object into JSON string.

This filter is mostly useful for debugging. When using the double curly {{value}} notation the binding is automatically converted to JSON.

<span ng:non-bindable>{{ {a:1, b:[]} | json }}</span>: <pre>{{ {a:1, b:[]} | json }}</pre>