diff --git a/src/editors/number.js b/src/editors/number.js index acc65ee4d..a1def6799 100644 --- a/src/editors/number.js +++ b/src/editors/number.js @@ -6,6 +6,6 @@ JSONEditor.defaults.editors.number = JSONEditor.defaults.editors.string.extend({ return 2; }, getValue: function() { - return this.value*1; + return this.value===''?undefined:this.value*1; } }); diff --git a/src/editors/object.js b/src/editors/object.js index 22410db84..6940ba9b5 100644 --- a/src/editors/object.js +++ b/src/editors/object.js @@ -698,7 +698,7 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({ if(this.jsoneditor.options.remove_empty_properties || this.options.remove_empty_properties) { for(var i in result) { if(result.hasOwnProperty(i)) { - if(!result[i]) delete result[i]; + if(typeof result[i] === 'undefined' || result[i] === '') delete result[i]; } } } @@ -712,7 +712,7 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({ if(!this.editors.hasOwnProperty(i)) continue; this.value[i] = this.editors[i].getValue(); } - + if(this.adding_property) this.refreshAddProperties(); }, refreshAddProperties: function() {