
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How can I filter JSON data with multiple objects?
To filter JSON data with multiple objects, you can use the concept of filter along with ==.
Example
const jsonObject= [ { studentId:101, studentName:"David" }, { studentId:102, studentName:"Mike" }, { studentId:103, studentName:"David" }, { studentId:104, studentName:"Bob" } ] var result=jsonObject.filter(obj=> obj.studentName == "David"); console.log(result);
To run the above program, you need to use the following command −
node fileName.js.
Output
Here, my file name is demo194.js. This will produce the following output −
PS C:\Users\Amit\javascript-code> node demo194.js [ { studentId: 101, studentName: 'David' }, { studentId: 103, studentName: 'David' } ]
- Related Articles
- How we can convert Python objects into JSON objects?
- How can I preserve Python tuples with JSON?
- How can I filter string value with starting letter?
- How can we filter data with the help of MySQL subquery?
- How can we merge two JSON objects in Java?
- Filter Pandas Dataframe with multiple conditions
- How do I loop through a JSON file with multiple keys/sub-keys in Python?
- How can I select an element with multiple classes in jQuery?
- Filter JavaScript array of objects with another array
- How can we write JSON objects to a file in Java?\n
- How I can create Python class from JSON object?
- How can I represent python tuple in JSON format?
- Calculate average from JSON data based on multiple filters JavaScript
- Can I filter a column in PN in SAP HANA with REGEX?
- While fetching the data as output, how can I use multiple conditions on same column?

Advertisements