VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/angularjs-json-filter/

⇱ AngularJS json Filter - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

AngularJS json Filter

Last Updated : 11 Jul, 2025

The json filter in AngularJs is used to convert a JavaScript object into a JSON. string.JavaScript object that we are using can be of any kind of JavaScript Object. The json filter piped the object or any expression with JSON so that the result will be displayed in the form of a list, which is bound with the expression syntax.

Syntax:

{{ object | json : spacing }}

Parameter value:

  • json: It is used to specify that the object should be displayed in JSON format. 
  • spacing: It is an optional parameter with a default value of 2 that specifies the number of spaces per indentation. 

Example 1: This example will display the marks of students in JSON. 

Output: 

👁 Image
 

Example 2: This example will display the fruits name in JSON with 10 spaces per indentation 

Output:

👁 Image
 
Comment

Explore