AngularJS Tutorial - JSON Filter








The following code shows how to format array to json string using JSON Filter.

Example


<!doctype html>
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.js"></script>
</head><!--  www  . java2s.c  om-->
<body>
  <div>
    <h5>Output JSON:</h5>
    <div>{{ {'name': 'XML', 'Side': 'Client'} | json }}</div>
  </div>
</body>
</html>

The code above is rendered as follows: