I want to write a code that can iterate the given JSONObject and would select only the key-value pair and insert it to a map.
For instance, this is my JOSNObject ->

> 
> {
> "\_id": {
> "docId": "123456"
> },
> "meta": {
> "tId": "8267"
> },
> "body": {
> "startDate": {
> "sdate": "2020-01-01T06:00:00Z"
> },
> "endDate": {
> "edate": "2021-06-30T05:00:00Z"
> }
> }
> }
> 
> 
> 

I want to have only the actual/useful key-value pair in a map, like

> 
> "docId"="123456", "tId"="8267", "sdate"="2020-01-01T06:00:00Z" , "edate"="2021-06-30T05:00:00Z"
> 
> 
> 

Any help would be much appreciated!

Just to make things much clear I'm looking for a solution or a way where I can get the value of JSONObject without specifying the key name explicitly.