title: Convert a nested data structure to use a class object
body: <p>I have the following:</p>
  
  <pre><code>data = [
      {
          "user":{"firstName":"John","lastName":"Doe"},
          "info":{"x":1,"y":2},
          "moreInfo":{"name":"johns12info"}
      },
      {
          "user":{"firstName":"John","lastName":"Doe"},
          "info":{"x":2,"y":2},
          "moreInfo":{"name":"johns22info"}
      },
      {
          "user":{"firstName":"Mary","lastName":"Doe"},
          "info":{"x":2,"y":2},
          "moreInfo":{"name":"marys22info"}
      }
  </code></pre>
  
  <p>]</p>
  
  <p>However, i wish for the user members to be objects of type User. So I wish to convert the above to the following:</p>
  
  <pre><code>data = [
      {
          "user":User({"firstName":"John","lastName":"Doe"}),
          "info":{"x":1,"y":2},
          "moreInfo":{"name":"johns12info"}
      },
      {
          "user":User({"firstName":"John","lastName":"Doe"}),
          "info":{"x":2,"y":2},
          "moreInfo":{"name":"johns22info"}
      },
      {
          "user":User({"firstName":"Mary","lastName":"Doe"}),
          "info":{"x":2,"y":2},
          "moreInfo":{"name":"marys22info"}
      }
  </code></pre>
  
  <p>]</p>
  
  <p>What javascript ES6 conversion can I use that is tidy and robust (the conversion should not explicitly mention <code>info</code> or <code>moreInfo</code>)? In python I would probably have used comprehensions to do this but Array comprehensions in javascript are non standard.</p>