Here is my Json File:
{
\"models\":{},
\"path\":[
{
\"path\":\"/web-profiles\",
\"operations\":[
{
This should do the trick::
Iterator keys = jsonObject.keys();
while(keys.hasNext()) {
String key = keys.next();
boolean propertyValuePresent = jsonObject.get(key) != null
&& jsonObject.get(key)!="null"
&& !jsonObject.get(key).toString().isEmpty();
if(propertyValuePresent){
jsonObject.remove(key);
}
}