Remove key which has null value from json object.
npm i --save nnjson
var nnjson = require('nnjson');
var user = {
name: 'Nomura Nori',
age: '36',
school_id: null,
posts: [{
title: 'node package',
content: 'you can remove null fields in json object using nnjson',
photo_id: 123,
},{
title: 'node package',
content: 'you can remove null fields in json object using nnjson',
photo_id: null,
},
]
}
var newUser = nnjson.removeNull(user);
console.log (newUser)
{
name: 'Nomura Nori',
age: '36',
posts: [{
title: 'node package',
content: 'you can remove null fields in json object using nnjson',
photo_id: 123,
},{
title: 'node package',
content: 'you can remove null fields in json object using nnjson',
},
]
}