title: wiremock post request json body property value is dynamic generated value how to stub
body: <p>Am new to <strong>wiremock</strong>, am using wiremock in my spring boot integration test for mocking one of the external http call.</p>
  
  <p>My json request body contains two dynamic properties, all other fields am able to set and stub in the request only two field values am not able to set as they are dynamic values.</p>
  
  <p>As these are dynamic in nature, I mean value of the property is random-auto-genarated values. Is there a way to ignore these properties and remaining all properties are anyhow matching. </p>
  
  <p>I know that ignore is available for extra fields and array order </p>
  
  <pre><code>withRequestBody(equalToJson(requestJson, true, true))
  </code></pre>
  
  <blockquote>
    <p>true      ignoreArrayOrder</p>
    
    <p>true      ignoreExtraField</p>
  </blockquote>
  
  <p>I want to know similar to above, ignore feature to specific property (user can mention the property name so that property it should ignore) is available? </p>
  
  <p>I have a following json request body that I need to stub in wire mock post so am using </p>
  
  <h2>requestJson</h2>
  
  <pre><code>{
     "property_one" : "Anand Sweets",
     "property_two" : "Guru Sweets",
     "property_three" : "Kranthi Sweets",
     "property_four" : auto-generated-number,  // dynamic number from code
     "property_five" : null,
     "propertysix" : " "GST128093",
     "property_seven" : auto-generated-number, // dynamic number from code
     "property_eight" : 13890139,
     "property_nine" : 1290.90,
     "property_ten" : "X239GDIJD9090"
  </code></pre>
  
  <p>}</p>
  
  <h2>Stubbing</h2>
  
  <pre><code>stubFor(post(urlEqualTo(testUrl))
              .withHeader(CUSTKEY, equalTo(CUST_VALUE))
              .withHeader(TOKENKEY, equalTo(TOKEN_VALUE))
              .withHeader(MATCHKEY, equalTo(MATCH_VALUE))
              .withRequestBody(equalToJson(requestJson, true, true))
              .willReturn(aResponse()
                      .withStatus(200)
                      .withHeader("Content-Type", "application/json")
                      .withBody(responseJson)
              )
      );
  </code></pre>
  
  <h2>responseJson</h2>
  
  <pre><code>{
       "Success": true,
       "message": "request processed successfully",
       "success_code": 9000,
       "external": "AKALDJKAD138948934" 
  }
  </code></pre>
  
  <p>Here in the request json, I have around almost <strong>60 to 70</strong> properties, except for <em>property_four and property_seven</em> remaining all fields match is happening properly.</p>
  
  <p>I wanted to know how to ignore these two fields with equaltoJson(requestJson) in wiremock, as these field values are dynamic in nature, I wanted to skip these properties from matching.</p>
  
  <p>Any one have any Idea how to skip or ignore these properties Or any other good solution to this problem.</p>
  
  <p>I thought of using <strong>withRequestBody(matchingJsonPath(PATH))</strong>  but with <strong>huge and complex request</strong>, </p>
  
  <p>I felt, that is not the right solution.</p>
  
  <p>My request body is so complex, I mean many fields, just for example, I mentioned only ten properties with example properties and values.</p>
  
  <p>Thanks in advance, as I said earlier am new to wiremock.</p>