Q:

Firebase won't save keys with null values

I have an object like:
var _json = { "objects":[{
    "type":"path", "originX":"center", "originY":"center", "left":48.59, 
    "top":132.5, "width":64.5,"height":173, "fill":null,"stroke":"#3f7cc4", 
    "strokeWidth":12,"strokeDashArray":null
}]}

I save this object using Firebase as:
var myDataRef = new Firebase(<...>);
myDataRef.child("saved_projects").child(authData.uid).update({'P3': _json});

But, when I retrieve the same using Firebase on method and get the value as:
snapshot.val()

I get the object but keys with null values got removed i.e. I only got:
{"objects":[ {"type":"path", "originX":"center", 
 "originY":"center","left":48.59, "top":132.5,"width":64.5, 
 "height":173, "stroke":"#3f7cc4","strokeWidth":12
}]}

This is causing me some weird issues since I'm using Fabric.js and it needs these values.
Please help!
EDIT / UPDATE(Hack)
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 a nicer way to do.
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);

A:

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);

