JSFiddle - React, Tailwind, and code Playground

JavaScript

var jsonObj = '{"test1":"","test2":"2","test3":"","test4":"4"}';
var jsObj = JSON.parse(jsonObj);

function removeNull(element,index,array){
    if (this[element] == ""){
        delete this[element];
    }
}