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.
{{ json_expression | json}}
$filter('json')(object)
| Param | Type | Details |
|---|---|---|
| object | * |
Any JavaScript object (including arrays and primitive types) to filter. |
| string | JSON string. |
<pre>{{ {'name':'value'} | json }}</pre>
it('should jsonify filtered objects', function() {
expect(element(by.binding("{'name':'value'}")).getText()).toMatch(/\{\n "name": ?"value"\n}/);
});