title: Bulk update using the JSON Merge Patch Specification (RFC 7396)
body: <p>I am having a problem understanding how to use <code>JSON Merge Patch</code> <a href="https://www.rfc-editor.org/rfc/rfc7396" rel="nofollow noreferrer">(RFC 7396)</a> when dealing with bulk updates, or if it even makes sense. I can't find any specifications or examples.</p>
  <p><strong>Description</strong></p>
  <p>We have a <code>/contacts</code> endpoint and we implemented</p>
  <ul>
  <li>a <code>POST</code> method to create Contacts and</li>
  <li>a <code>PATCH</code> method to update fields on a Contact. The PATCH method is compliant with the <code>JSON Merge Patch</code> specification.</li>
  </ul>
  <p>So let's say <code>Contact</code> has an <code>Id</code>, and an <code>Organisation</code>. And that we have the following 2 Contact objects</p>
  <pre><code>{
    &quot;id&quot; : &quot;123&quot;,
    &quot;organisation&quot; : &quot;Org1. Ltd&quot;
  }
  </code></pre>
  <p>and</p>
  <pre><code>{
    &quot;id&quot; : &quot;456&quot;,
    &quot;organisation&quot; : &quot;Org2. Ltd&quot;
  }
  </code></pre>
  <p><strong>Updating a single Contact using <em>JSON Merge Patch</em> Specification</strong></p>
  <p>Now using the PATCH endpoint, I can update a Contact's Organisation this way:</p>
  <pre><code>PATCH /contacts/123
  Content-Type: application/merge-patch+json
  
  {
    &quot;organisation&quot; : &quot;A better name for my Org. Ltd&quot;
  }
  </code></pre>
  <p><strong>Updating several Contacts using <em>JSON Patch</em> Specification</strong></p>
  <p>I understand how to update several contacts at once using the <code>JSON Patch</code> specification (<a href="https://www.rfc-editor.org/rfc/rfc6902" rel="nofollow noreferrer">RCF 6902</a>), it would be something like:</p>
  <pre><code>PATCH /contacts
  Content-Type: application/json-patch+json
  
  [
     { &quot;op&quot;: &quot;update&quot;, &quot;path&quot;: &quot;/123/organisation&quot;, &quot;value&quot; : &quot;A better name for my Org. Ltd&quot; },
     { &quot;op&quot;: &quot;update&quot;, &quot;path&quot;: &quot;/456/organisation&quot;, &quot;value&quot; : &quot;Acme Ltd&quot; }
  ]
  </code></pre>
  <p><strong>Question: Updating several Contacts using <em>JSON Merge Patch</em> Specification</strong></p>
  <p>My question is how am I supposed to write the JSON if I want to update both contacts at once using the <code>JSON Merge Patch</code> specification?</p>
  <p>I can think of something like this</p>
  <pre><code>PATCH /contacts
  Content-Type: application/merge-patch+json
  
  [
      &quot;123&quot; : {
          &quot;organization&quot;:&quot;A better name for my Org. Ltd&quot;
      },
      &quot;456&quot; : {
          &quot;organization&quot;:&quot;Acme Ltd&quot;
      }
  ]
  </code></pre>
  <p>But it looks a bit ugly and non standard.</p>