handle null values in array of objects

When encoding:

If an array of objects has null values like key2 in {key1: 'asdf', key2: null, key3: 123} the stringify() function dies trying to regex replace on null.