title: Retrieve all the nested keys of json object in java
body: <p>How can I fetch all the nested keys of JSON object?</p>
  <p>Below is the JSON input and it should return all the keys and subkeys with dot-separated like below output.</p>
  <p>Input:</p>
  <pre><code>{
    &quot;name&quot;: &quot;John&quot;,
    &quot;localizedName&quot;: [
      {
        &quot;value&quot;: &quot;en-US&quot;,
      }
    ],
    &quot;entityRelationship&quot;: [
      {
        &quot;entity&quot;: &quot;productOffering&quot;,
        &quot;description&quot;: [
          {
            &quot;locale&quot;: &quot;en-US&quot;,
            &quot;value&quot;: &quot;New Policy Description&quot;
          },
          {
            &quot;locale&quot;: &quot;en-US&quot;,
            &quot;value&quot;: &quot;New Policy Description&quot;
          }
  
        ]
      }
    ]
  }
  </code></pre>
  <p>Output:</p>
  <pre><code>[&quot;name&quot;,&quot;localizedName&quot;,&quot;localizedName.value&quot;,&quot;entityRelationship&quot;,&quot;entityRelationship.entity&quot;,&quot;entityRelationship.description&quot;,&quot;entityRelationship.description.locale&quot;,&quot;entityRelationship.description.value&quot;] 
  </code></pre>