title: Save Array as Map in Cloud Firestore
body: <p>I have an array of object i am creating and saving to firestore as per the code below:</p>
  <pre><code>var user1 = [String : Any]()
  var user2 = [String : Any]()
  var user3 = [String : Any]()
  
  user1.updateValue(&quot;UID1&quot;, forKey: &quot;UserID&quot;)
  user1.updateValue(&quot;John&quot;, forKey: &quot;fName&quot;)
  user1.updateValue(&quot;Smith&quot;, forKey: &quot;lName&quot;)
  
  user2.updateValue(&quot;UID2&quot;, forKey: &quot;UserID&quot;)
  user2.updateValue(&quot;John&quot;, forKey: &quot;fName&quot;)
  user2.updateValue(&quot;Doe&quot;, forKey: &quot;lName&quot;)
  
  user3.updateValue(&quot;UID3&quot;, forKey: &quot;UserID&quot;)
  user3.updateValue(&quot;Jane&quot;, forKey: &quot;fName&quot;)
  user3.updateValue(&quot;Doe&quot;, forKey: &quot;lName&quot;)
  
  var userDetailsArray = [[String:Any]]()
  
  userDetailsArray.append(user1)
  userDetailsArray.append(user2)
  userDetailsArray.append(user3)
  
  startCompBatch.setData([&quot;userDetails&quot; : userDetailsArray], forDocument: doRef, merge: true)
  </code></pre>
  <p>In the firestore console this is saving as follows:
  <a href="https://i.stack.imgur.com/ja7S8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ja7S8.png" alt="enter image description here" /></a></p>
  <p>This is ok but what i am trying to active is the following:
  <a href="https://i.stack.imgur.com/V4SKc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/V4SKc.png" alt="enter image description here" /></a></p>
  <p>I am sure this is simple but i cant find anything that has pointed me in the correct direction.</p>