title: Mailchimp api 3.0 error: "Schema describes object, array found instead" is the code or on mailchimp's end?
body: <p>I need to bulk update subscribers in my mailchimp lists using mailchimp's api and subscriber lists in my database.</p>
  
  <p>I am trying implement the solution to the question here:
  <a href="https://stackoverflow.com/questions/40973388/mailchimp-api-3-0-batch-subscribe">Mailchimp API 3.0 Batch Subscribe
  </a>
  but I'm getting the error </p>
  
  <blockquote>
    <p>{"type":"<a href="http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/" rel="nofollow noreferrer">http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/</a>","title":"Invalid Resource","status":400,"detail":"The resource submitted could not be validated. For field-specific details, see the 'errors' array.","instance":"8198a6e9-9a7c-4e00-8365-3a7062f047f3","errors":[{"field":"","message":"Schema describes object, array found instead"}]}</p>
  </blockquote>
  
  <p>I've seen people with similar issues, and sometimes it's a problem on mailchimp's end and sometimes it's a problem with how the data is being passed. Any insight into whether I need to fix the code or contact mailchimp would be appreciated!</p>
  
  <p>script in question:</p>
  
  <pre><code>&lt;?php
  $apikey  = 'myapi'; // Your Mailchimp ApiKey
  $list_id = 'mylist'; // your List ID Where you want to add subscriber
  
  $servername = 'myserver';
  $username   = 'myun';
  $password   = 'mypw';
  $dbname     = 'mydb';
  // Create connection
  $conn = new mysqli($servername, $username, $password, $dbname);
  // Check connection
  if ($conn-&gt;connect_error) {
      die('Connection failed: ' . $conn-&gt;connect_error);
  }
  
  $sql       = 'SELECT * FROM emails Limit 2';
  $result    = $conn-&gt;query($sql);
  $finalData = array();
  if ($result-&gt;num_rows &gt; 0) {
      // output data of each row
      while ($row = $result-&gt;fetch_assoc()) {
          $individulData = array(
              'apikey'        =&gt; $apikey,
              'email_address' =&gt; $row['email'],
              'status'        =&gt; $row['status'],//subscribe,pending,unsubscribe
              'merge_fields'  =&gt; array(
                  'FNAME' =&gt; $row['FNAME'],
                  'LNAME' =&gt; $row['LNAME'],
                  'BARCODE' =&gt; $row['BARCODE'],
                  'SERVICE' =&gt; $row['SERVICE'],
                  'PURCHASE' =&gt; $row['PURCHASE'],
              )
          );
  
          $json_individulData        = json_encode($individulData);
          $finalData['operations'][] =
              array(
                  "method" =&gt; "PUT",
                  "path"   =&gt; "/lists/$list_id/members/",
                  "body"   =&gt; $json_individulData
              );
      }
  }
  
  $api_response = batchSubscribe($finalData, $apikey);
  print_r($api_response);
  $conn-&gt;close();
  
  /**
   * Mailchimp API- List Batch Subscribe added function
   *
   * @param array  $data   Passed you data as an array format.
   * @param string $apikey your mailchimp api key.
   *
   * @return mixed
   */
  function batchSubscribe(array $data, $apikey)
  {
      $auth          = base64_encode('user:' . $apikey);
      $json_postData = json_encode($data);
      $ch            = curl_init();
      $dataCenter    = substr($apikey, strpos($apikey, '-') + 1);
      $curlopt_url   = 'https://' . $dataCenter . '.api.mailchimp.com/3.0/batches/';
      curl_setopt($ch, CURLOPT_URL, $curlopt_url);
  
      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
          'Authorization: Basic ' . $auth));
      curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/3.0');
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
      curl_setopt($ch, CURLOPT_TIMEOUT, 10);
      curl_setopt($ch, CURLOPT_POST, true);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $json_postData);
  
  
      $result = curl_exec($ch);
      return $result;
  }
  
  ?&gt;
  </code></pre>