title: Changing keys names in a nested josn object in java
body: <p>Could anyone help me with this issue please, I have a JSONObject which is highly nested to many levels and I want to replace certain keys with different values? Below is my JSONOBject:</p>
  
  <pre><code>{
  "nullable": null,
  "localPart": null,
  "prefix": null,
  "precision": null,
  "name": "Put_Location_Request",
  "namespace": null,
  "scale": null,
  "unicode": null,
  "type": null,
  "maxLength": null,
  "srid": null,
  "subEntities": [{
      "nullable": null,
      "localPart": null,
      "prefix": null,
      "precision": null,
      "name": "Location_Reference",
      "namespace": null,
      "scale": null,
      "unicode": null,
      "type": null,
      "maxLength": null,
      "srid": null,
      "subEntities": [{
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "ID",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }]
  }, {
      "nullable": null,
      "localPart": null,
      "prefix": null,
      "precision": null,
      "name": "Location_Data",
      "namespace": null,
      "scale": null,
      "unicode": null,
      "type": null,
      "maxLength": null,
      "srid": null,
      "subEntities": [{
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Location_ID",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Effective_Date",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Location_Name",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Location_Usage_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Location_Type_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Location_Attribute_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Superior_Location_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Inactive",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Latitude",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Longitude",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Altitude",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Time_Profile_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Locale_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Display_Language_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Time_Zone_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Default_Currency_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "External_Name",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Default_Job_Posting_Location_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Trade_Name",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Worksite_ID_Code",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Global_Location_Number",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Location_Identifier",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": null
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Default_Ship-To_Location_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Associate_Deliver-To_Location_Reference",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "ID",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Instructional_Site_Data",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Academic_Unit_Reference",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": [{
                  "nullable": null,
                  "localPart": null,
                  "prefix": null,
                  "precision": null,
                  "name": "ID",
                  "namespace": null,
                  "scale": null,
                  "unicode": null,
                  "type": null,
                  "maxLength": null,
                  "srid": null,
                  "subEntities": null
              }]
          }, {
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Instructional_Site_Data_Capacity",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }, {
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Off-Site",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }, {
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Instructional_Use_Only",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Student_Housing_Assignment_Data",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Academic_Unit_Reference",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": [{
                  "nullable": null,
                  "localPart": null,
                  "prefix": null,
                  "precision": null,
                  "name": "ID",
                  "namespace": null,
                  "scale": null,
                  "unicode": null,
                  "type": null,
                  "maxLength": null,
                  "srid": null,
                  "subEntities": null
              }]
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Location_Training_Room_Data",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Link",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }, {
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Capacity",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }, {
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Directions",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }, {
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Equipment",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }, {
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Reservation_Details",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }, {
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Video_Conference_Details",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }, {
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Additional_Details",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": null
          }]
      }, {
          "nullable": null,
          "localPart": null,
          "prefix": null,
          "precision": null,
          "name": "Contact_Data",
          "namespace": null,
          "scale": null,
          "unicode": null,
          "type": null,
          "maxLength": null,
          "srid": null,
          "subEntities": [{
              "nullable": null,
              "localPart": null,
              "prefix": null,
              "precision": null,
              "name": "Address_Data",
              "namespace": null,
              "scale": null,
              "unicode": null,
              "type": null,
              "maxLength": null,
              "srid": null,
              "subEntities": [{
                  "nullable": null,
                  "localPart": null,
                  "prefix": null,
                  "precision": null,
                  "name": "Country_Reference",
                  "namespace": null,
                  "scale": null,
                  "unicode": null,
                  "type": null,
                  "maxLength": null,
                  "srid": null,
                  "subEntities": [{
                      "nullable": null,
                      "localPart": null,
                      "prefix": null,
                      "precision": null,
                      "name": "ID",
                      "namespace": null,
                      "scale": null,
                      "unicode": null,
                      "type": null,
                      "maxLength": null,
                      "srid": null,
                      "subEntities": null
                  }]
              }, .........
  </code></pre>
  
  <p>In the above JSONObject I want to replace key nullable with $nullable and localPart with $localPart etc. Can anyone help me with Java code.</p>