title: Javascript Object into array move object property name into array key
body: <p>I have this nested objects:</p>
  
  <pre><code>"State Names": {
      "State Cities": {
          "Los Angeles": {
              "about": "story",
              "zip": "91721"
          },
      }
  }
  </code></pre>
  
  <p>and I was trying to make it look like this:</p>
  
  <pre><code>state: {
      city: [
          "name": "Los Angeles",
          "about": "story",
          "zip": "91721"
      ]
  }
  </code></pre>
  
  <p>I've tried below code:</p>
  
  <pre><code>    var o = {
          "State Names": {
              "State Cities": {
                  "Los Angeles": {
                      "about": "story",
                      "zip": "91721"
                  },
              }
          }
      }
      var v = o["State Names"];
      var z = v["State Cities"];
      const result = Object.keys(z).map(i =&gt; z[i]);
  
      const state = {
          city: [...result]
      }
      this.setState({
          state
      })
  </code></pre>
  
  <p>But my result doesn't showing city names, only showing about and zip. How do I include object key name into array as property during the map function?</p>