title: How to populate React array from JSON Nodejs back end
body: <p>I'm very new to React.
  I've set up a Nodejs back end which reads a JSON file in the following format:</p>
  
  <pre><code>{
      "cert1" : {
          "name" : "www.google.com",
          "state" : "valid",
          "days" : "482"
      },
      "cert2" : {
          "name" : "www.facebook.com",
          "state" : "valid",
          "days" : "182"
      },
      .
      .
      .
  }
  </code></pre>
  
  <p>I want to display this data in a table and first need to put it into an array. I've managed to display <code>www.google.com</code> using the following code.</p>
  
  <pre><code>class App extends Component {
    state = {
      name  : '',
      state : '',
      days  : '',
      response : ''
    };
  
  
    componentDidMount() {
      this.callApi()
        .then(res =&gt; {
          this.setState({ 
            response: res.cert1.name
          })
        })
        .catch(err =&gt; console.log(err));
    }
  
  
    callApi = async () =&gt; {
      const response = await fetch('/list-certs');
      const body = await response.json();
  
      if (response.status !== 200) throw Error(body.message);
  
      return body;
    };
  
    render() {
      return (
        &lt;div className="App"&gt;
          &lt;div className="App-header"&gt;
            &lt;img src={logo} className="App-logo" alt="logo" /&gt;
            &lt;h2&gt;Welcome to React&lt;/h2&gt;
          &lt;/div&gt;
          &lt;p className="App-intro"&gt;
            {this.state.response}
          &lt;/p&gt;
        &lt;/div&gt;
      );
    }
  }
  </code></pre>
  
  <p>How do I map over the whole JSON file and populate some arrays with all the entries? Right now I'm calling <code>res.cert1.name</code> but each cert entry in the JSON file has a different name (cert1, cert2, cert3 etc.) so how do I convert <code>res.cert1.name</code> into a generic call for any cert entry in the JSON file?</p>