Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove null values from json object in javascript

You can use the filter() method to remove null values from a JSON object:

let data = { a: 1, b: 2, c: null }; 
let newData = data.filter(item => item !== null); 
console.log(newData); // { a: 1, b: 2 }
 
PREVIOUS NEXT
Tagged: #remove #null #values #json #object #javascript
ADD COMMENT
Topic
Name
6+1 =