JSON.isOfPattern = function(json, props){
if (json == null) return false;
for(var key in props){
if (key in json == false) return false;
if (typeof props == 'object' && !JSON.isOfPattern(json[key],props[key])) return false;
}
return true;
}
var json = { name: 'A', address: { city: 'Berlin'}};
JSON.isOfPattern(json, {name:null, address: {city: null} });