1
{
    "Food" : {
        "Abc" : "xyz",
        "Meat" : {
            "kind" : "Turkey",
            "Size" : {},
            "Id" : "9747"
        },
        "Fruit" : [{
                "Name" : "Orange",
                "Code" : "Fr",
                "NewCode" : "Fu1"
            }, {
                "Name" : "Apple",
                "Code" : "App",
                "Id" : "23"
            }, {
                "Name" : "Grape",
                "Code" : "Grp"
            }
        ],
        "Vegetables" : {}
    }
}

I need check if 'Id' is present in Meat, Fruit and Vegetables and if it is present then delete the Id(Key - Value) pair. Sometimes Id is present (ex. Meat and Fruit) or not present for a particular section(Fruit --> Grape) or sometime nothing is present (Vegetables). I've been able to remove Abc(Key-Value) pair but i've not been able to do the same for Meat, Fruit and Vegetables dictionaries. Can someone help me out.

dawg
  • 98,345
  • 23
  • 131
  • 206
user3117045
  • 47
  • 2
  • 9

0 Answers0