I have a nested JSON which looks like this:
var unfilteredJSON = {
"payload":{
"oldKeys":[
"125262"
],
"keyData":[
{
"key":"123456",
"products":[
{
"prodId":"H1",
"qty":"1"
},
{
"prodId":"H2",
"qty":""
}
],
"rushFee":"true"
},
{
"key":"234234",
"products":[
{
"prodId":"H1",
"qty":"1"
},
{
"prodId":"H2",
"qty":""
}
],
"rushFee":"false"
}
],
"submit":"false"
}
}
The qty key can have empty values in the object. I want to filter the data with jQuery method and remove the object with blank qty so the JSON can look like this -
{
"payload":{
"oldKeys":[
"125262"
],
"keyData":[
{
"key":"123456",
"products":[
{
"prodId":"H1",
"qty":"1"
},
],
"rushFee":"true"
},
{
"key":"234234",
"products":[
{
"prodId":"H1",
"qty":"1"
},
],
"rushFee":"false"
}
],
"submit":"false"
}
}
Please help.