I convert a json file to xml file and in my json file I have :

```
"settingsData": { 
    "settingsname": "",
    "username": "Dave",
    "password": "",
    "domain": "Benji",
}

```

My output is:

```
 <data name="settingsname" value=""/>
 <data name="username" value="Dave"/>
 <data name="password" value=""/>
 <data name="domain" value="Benji"/>

```

Here is my function :

```
var settings = [];

function extractData(data, settingsData){
    settings.push({
        name: 'settingsname',
        value: data.settingsname
    });
    settings.push({
        name: 'username',
        value: data.username
    });
    settings.push({
        name: 'password',
        value: data.password
    }); 
    settings.push({
        name: 'domain',
        value: data.domain
    }); 
    return settings;
}

```

The output needs to be :

```
<data name="username" value="Dave"/>
<data name="domain" value="Benji"/>

```

My Question is how can I remove the empty strings or how can I check if it is an empty string then do not add it to the array?

I used something like the following if statement, but it didn’t work :

```
 if (settingsData.settingsname !== ""){
    settings.push({
        name: 'settingsname',
        value: data.settingsname
    });
 }

```

Thanks in advance!