I've got a dictionary that I am trying to remove a specific object.
{
  "authorizationQualifier": "00",
  "testIndicator": " ",
  "functionalGroups": [
    {
      "functionalIdentifierCode": "SC",
      "applicationSenderCode": "6088385400",
      "applicationReceiverCode": "3147392555",
      "transactions": [
        {
          "name": null,
          "transactionSetIdentifierCode": "832",
          "transactionSetControlNumber": "000000001",
          "implementationConventionReference": null,
          "segments": [
            {
              "BCT": {
                "BCT01": "PS",
                "BCT03": "2",
                "id": "BCT"
                     }
             }
           ]
         }
       ]
     }
   ]
}
I'm trying to delete the "segments" list of objects while keeping the functional groups and transactions lists.
I've tried,
ediconverted = open("converted.json", "w")
with open('832.json','r') as jsonfile:
    json_content = json.load(jsonfile)
for element in json_content:
    element.pop('segments', None)
with open('converted.json', 'w') as data_file:
    json_content = json.dump(json_content, data_file)
 
     
    