Firebase won't save keys with null values
For the time being I'm using a weird HACK, before storing the object to Firebase I'm converting all the null values to 0. But I want to know much nicer way, please!
function recursivelyReplaceNullToZero(j) {
for (var i in j){
if (typeof j[i] === "object") {
recursivelyReplaceNullToZero(j[i]);
}
if (j[i] === null) {
j[i] = 0;
}
}
}
recursivelyReplaceNullToZero(_json);