title: JMeter JSON Assertion: Path must not end with a '.' or '..'
body: <p>I'm trying to replicate the JMeter script described here: <a href="https://www.blazemeter.com/blog/selenium-vs-jmeter-which-one-should-you-choose-and-when" rel="nofollow noreferrer">https://www.blazemeter.com/blog/selenium-vs-jmeter-which-one-should-you-choose-and-when</a> -- specifically under the &quot;Front End: Testing Custom Communication Channels&quot;.</p>
  <p>The author talks about setting up JSON assertions to verify response data, which is where I'm stuck. I'll post my code at the end, but what I've done is setup a HTTP request to POST to https:\reqres.in\api\users, sending the JSON payload shown in the article:</p>
  <pre><code>{
      &quot;name&quot;: &quot;new_user&quot;,
      &quot;job&quot;: &quot;user_role&quot;
  }
  </code></pre>
  <p>I then have the HTTP Header Manager setup with the header &quot;Content-Type&quot; set to &quot;application/JSON&quot;.  Finally, there's a JSON response assertion I tried to setup to replicate the author's description. I checked the box for &quot;Match as regular expression&quot; and set the expected value as <code>[0-9]+</code>. (I'm guessing this is where I went horribly wrong.)</p>
  <p>The script's view results tree listener shows that the script did get a response:</p>
  <pre><code>{&quot;name&quot;:&quot;new_user&quot;,&quot;job&quot;:&quot;user_role&quot;,&quot;id&quot;:&quot;86&quot;,&quot;createdAt&quot;:&quot;2020-11-16T23:41:04.645Z&quot;}
  </code></pre>
  <p>But the script failed because the assertion failed with this message:</p>
  <blockquote>
  <p>Assertion error: false<br />
  Assertion failure: true Assertion failure
  message: Path must not end with a '.' or '..'</p>
  </blockquote>
  <p>Here's my full script:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;jmeterTestPlan version=&quot;1.2&quot; properties=&quot;5.0&quot; jmeter=&quot;5.1 r1853635&quot;&gt;
    &lt;hashTree&gt;
      &lt;TestPlan guiclass=&quot;TestPlanGui&quot; testclass=&quot;TestPlan&quot; testname=&quot;Test Plan&quot; enabled=&quot;true&quot;&gt;
        &lt;stringProp name=&quot;TestPlan.comments&quot;&gt;&lt;/stringProp&gt;
        &lt;boolProp name=&quot;TestPlan.functional_mode&quot;&gt;false&lt;/boolProp&gt;
        &lt;boolProp name=&quot;TestPlan.serialize_threadgroups&quot;&gt;false&lt;/boolProp&gt;
        &lt;elementProp name=&quot;TestPlan.user_defined_variables&quot; elementType=&quot;Arguments&quot; guiclass=&quot;ArgumentsPanel&quot; testclass=&quot;Arguments&quot; testname=&quot;User Defined Variables&quot; enabled=&quot;true&quot;&gt;
          &lt;collectionProp name=&quot;Arguments.arguments&quot;/&gt;
        &lt;/elementProp&gt;
        &lt;stringProp name=&quot;TestPlan.user_define_classpath&quot;&gt;&lt;/stringProp&gt;
      &lt;/TestPlan&gt;
      &lt;hashTree&gt;
        &lt;Arguments guiclass=&quot;ArgumentsPanel&quot; testclass=&quot;Arguments&quot; testname=&quot;User Defined Variables&quot; enabled=&quot;true&quot;&gt;
          &lt;collectionProp name=&quot;Arguments.arguments&quot;&gt;
            &lt;elementProp name=&quot;host&quot; elementType=&quot;Argument&quot;&gt;
              &lt;stringProp name=&quot;Argument.name&quot;&gt;host&lt;/stringProp&gt;
              &lt;stringProp name=&quot;Argument.value&quot;&gt;wsf.cdyne.com&lt;/stringProp&gt;
              &lt;stringProp name=&quot;Argument.metadata&quot;&gt;=&lt;/stringProp&gt;
              &lt;stringProp name=&quot;Argument.desc&quot;&gt;Host of Webservice&lt;/stringProp&gt;
            &lt;/elementProp&gt;
          &lt;/collectionProp&gt;
        &lt;/Arguments&gt;
        &lt;hashTree/&gt;
        &lt;ConfigTestElement guiclass=&quot;HttpDefaultsGui&quot; testclass=&quot;ConfigTestElement&quot; testname=&quot;HTTP Request Defaults&quot; enabled=&quot;true&quot;&gt;
          &lt;elementProp name=&quot;HTTPsampler.Arguments&quot; elementType=&quot;Arguments&quot; guiclass=&quot;HTTPArgumentsPanel&quot; testclass=&quot;Arguments&quot; testname=&quot;User Defined Variables&quot; enabled=&quot;true&quot;&gt;
            &lt;collectionProp name=&quot;Arguments.arguments&quot;/&gt;
          &lt;/elementProp&gt;
          &lt;stringProp name=&quot;HTTPSampler.domain&quot;&gt;${host}&lt;/stringProp&gt;
          &lt;stringProp name=&quot;HTTPSampler.port&quot;&gt;&lt;/stringProp&gt;
          &lt;stringProp name=&quot;HTTPSampler.protocol&quot;&gt;&lt;/stringProp&gt;
          &lt;stringProp name=&quot;HTTPSampler.contentEncoding&quot;&gt;&lt;/stringProp&gt;
          &lt;stringProp name=&quot;HTTPSampler.path&quot;&gt;&lt;/stringProp&gt;
          &lt;stringProp name=&quot;HTTPSampler.concurrentPool&quot;&gt;4&lt;/stringProp&gt;
          &lt;stringProp name=&quot;HTTPSampler.connect_timeout&quot;&gt;&lt;/stringProp&gt;
          &lt;stringProp name=&quot;HTTPSampler.response_timeout&quot;&gt;&lt;/stringProp&gt;
        &lt;/ConfigTestElement&gt;
        &lt;hashTree/&gt;
        &lt;ThreadGroup guiclass=&quot;ThreadGroupGui&quot; testclass=&quot;ThreadGroup&quot; testname=&quot;Number of Users&quot; enabled=&quot;true&quot;&gt;
          &lt;stringProp name=&quot;ThreadGroup.on_sample_error&quot;&gt;continue&lt;/stringProp&gt;
          &lt;elementProp name=&quot;ThreadGroup.main_controller&quot; elementType=&quot;LoopController&quot; guiclass=&quot;LoopControlPanel&quot; testclass=&quot;LoopController&quot; testname=&quot;Loop Controller&quot; enabled=&quot;true&quot;&gt;
            &lt;boolProp name=&quot;LoopController.continue_forever&quot;&gt;false&lt;/boolProp&gt;
            &lt;stringProp name=&quot;LoopController.loops&quot;&gt;2&lt;/stringProp&gt;
          &lt;/elementProp&gt;
          &lt;stringProp name=&quot;ThreadGroup.num_threads&quot;&gt;5&lt;/stringProp&gt;
          &lt;stringProp name=&quot;ThreadGroup.ramp_time&quot;&gt;5&lt;/stringProp&gt;
          &lt;longProp name=&quot;ThreadGroup.start_time&quot;&gt;1375525852000&lt;/longProp&gt;
          &lt;longProp name=&quot;ThreadGroup.end_time&quot;&gt;1375525852000&lt;/longProp&gt;
          &lt;boolProp name=&quot;ThreadGroup.scheduler&quot;&gt;false&lt;/boolProp&gt;
          &lt;stringProp name=&quot;ThreadGroup.duration&quot;&gt;&lt;/stringProp&gt;
          &lt;stringProp name=&quot;ThreadGroup.delay&quot;&gt;&lt;/stringProp&gt;
        &lt;/ThreadGroup&gt;
        &lt;hashTree&gt;
          &lt;HTTPSamplerProxy guiclass=&quot;HttpTestSampleGui&quot; testclass=&quot;HTTPSamplerProxy&quot; testname=&quot;Rest Request&quot; enabled=&quot;true&quot;&gt;
            &lt;boolProp name=&quot;HTTPSampler.postBodyRaw&quot;&gt;true&lt;/boolProp&gt;
            &lt;elementProp name=&quot;HTTPsampler.Arguments&quot; elementType=&quot;Arguments&quot;&gt;
              &lt;collectionProp name=&quot;Arguments.arguments&quot;&gt;
                &lt;elementProp name=&quot;&quot; elementType=&quot;HTTPArgument&quot;&gt;
                  &lt;boolProp name=&quot;HTTPArgument.always_encode&quot;&gt;false&lt;/boolProp&gt;
                  &lt;stringProp name=&quot;Argument.value&quot;&gt;{&amp;#xd;
      &amp;quot;name&amp;quot;: &amp;quot;new_user&amp;quot;,&amp;#xd;
      &amp;quot;job&amp;quot;: &amp;quot;user_role&amp;quot;&amp;#xd;
  }&lt;/stringProp&gt;
                  &lt;stringProp name=&quot;Argument.metadata&quot;&gt;=&lt;/stringProp&gt;
                &lt;/elementProp&gt;
              &lt;/collectionProp&gt;
            &lt;/elementProp&gt;
            &lt;stringProp name=&quot;HTTPSampler.domain&quot;&gt;reqres.in&lt;/stringProp&gt;
            &lt;stringProp name=&quot;HTTPSampler.port&quot;&gt;&lt;/stringProp&gt;
            &lt;stringProp name=&quot;HTTPSampler.protocol&quot;&gt;https&lt;/stringProp&gt;
            &lt;stringProp name=&quot;HTTPSampler.contentEncoding&quot;&gt;&lt;/stringProp&gt;
            &lt;stringProp name=&quot;HTTPSampler.path&quot;&gt;\api\users&lt;/stringProp&gt;
            &lt;stringProp name=&quot;HTTPSampler.method&quot;&gt;POST&lt;/stringProp&gt;
            &lt;boolProp name=&quot;HTTPSampler.follow_redirects&quot;&gt;true&lt;/boolProp&gt;
            &lt;boolProp name=&quot;HTTPSampler.auto_redirects&quot;&gt;false&lt;/boolProp&gt;
            &lt;boolProp name=&quot;HTTPSampler.use_keepalive&quot;&gt;true&lt;/boolProp&gt;
            &lt;boolProp name=&quot;HTTPSampler.DO_MULTIPART_POST&quot;&gt;false&lt;/boolProp&gt;
            &lt;stringProp name=&quot;HTTPSampler.embedded_url_re&quot;&gt;&lt;/stringProp&gt;
            &lt;stringProp name=&quot;HTTPSampler.connect_timeout&quot;&gt;&lt;/stringProp&gt;
            &lt;stringProp name=&quot;HTTPSampler.response_timeout&quot;&gt;&lt;/stringProp&gt;
          &lt;/HTTPSamplerProxy&gt;
          &lt;hashTree&gt;
            &lt;HeaderManager guiclass=&quot;HeaderPanel&quot; testclass=&quot;HeaderManager&quot; testname=&quot;HTTP Header Manager&quot; enabled=&quot;true&quot;&gt;
              &lt;collectionProp name=&quot;HeaderManager.headers&quot;&gt;
                &lt;elementProp name=&quot;&quot; elementType=&quot;Header&quot;&gt;
                  &lt;stringProp name=&quot;Header.name&quot;&gt;Content-Type&lt;/stringProp&gt;
                  &lt;stringProp name=&quot;Header.value&quot;&gt;application/JSON&lt;/stringProp&gt;
                &lt;/elementProp&gt;
              &lt;/collectionProp&gt;
            &lt;/HeaderManager&gt;
            &lt;hashTree/&gt;
            &lt;JSONPathAssertion guiclass=&quot;JSONPathAssertionGui&quot; testclass=&quot;JSONPathAssertion&quot; testname=&quot;JSON Assertion on id&quot; enabled=&quot;true&quot;&gt;
              &lt;stringProp name=&quot;JSON_PATH&quot;&gt;$.&lt;/stringProp&gt;
              &lt;stringProp name=&quot;EXPECTED_VALUE&quot;&gt;[0-9]+&lt;/stringProp&gt;
              &lt;boolProp name=&quot;JSONVALIDATION&quot;&gt;true&lt;/boolProp&gt;
              &lt;boolProp name=&quot;EXPECT_NULL&quot;&gt;false&lt;/boolProp&gt;
              &lt;boolProp name=&quot;INVERT&quot;&gt;false&lt;/boolProp&gt;
              &lt;boolProp name=&quot;ISREGEX&quot;&gt;true&lt;/boolProp&gt;
            &lt;/JSONPathAssertion&gt;
            &lt;hashTree/&gt;
            &lt;JSONPathAssertion guiclass=&quot;JSONPathAssertionGui&quot; testclass=&quot;JSONPathAssertion&quot; testname=&quot;JSON Assertion on createdAt&quot; enabled=&quot;false&quot;&gt;
              &lt;stringProp name=&quot;JSON_PATH&quot;&gt;$.&lt;/stringProp&gt;
              &lt;stringProp name=&quot;EXPECTED_VALUE&quot;&gt;[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}Z&lt;/stringProp&gt;
              &lt;boolProp name=&quot;JSONVALIDATION&quot;&gt;true&lt;/boolProp&gt;
              &lt;boolProp name=&quot;EXPECT_NULL&quot;&gt;false&lt;/boolProp&gt;
              &lt;boolProp name=&quot;INVERT&quot;&gt;false&lt;/boolProp&gt;
              &lt;boolProp name=&quot;ISREGEX&quot;&gt;true&lt;/boolProp&gt;
            &lt;/JSONPathAssertion&gt;
            &lt;hashTree/&gt;
          &lt;/hashTree&gt;
        &lt;/hashTree&gt;
        &lt;ResultCollector guiclass=&quot;ViewResultsFullVisualizer&quot; testclass=&quot;ResultCollector&quot; testname=&quot;View Results Tree&quot; enabled=&quot;true&quot;&gt;
          &lt;boolProp name=&quot;ResultCollector.error_logging&quot;&gt;false&lt;/boolProp&gt;
          &lt;objProp&gt;
            &lt;name&gt;saveConfig&lt;/name&gt;
            &lt;value class=&quot;SampleSaveConfiguration&quot;&gt;
              &lt;time&gt;true&lt;/time&gt;
              &lt;latency&gt;true&lt;/latency&gt;
              &lt;timestamp&gt;true&lt;/timestamp&gt;
              &lt;success&gt;true&lt;/success&gt;
              &lt;label&gt;true&lt;/label&gt;
              &lt;code&gt;true&lt;/code&gt;
              &lt;message&gt;true&lt;/message&gt;
              &lt;threadName&gt;true&lt;/threadName&gt;
              &lt;dataType&gt;false&lt;/dataType&gt;
              &lt;encoding&gt;false&lt;/encoding&gt;
              &lt;assertions&gt;true&lt;/assertions&gt;
              &lt;subresults&gt;false&lt;/subresults&gt;
              &lt;responseData&gt;false&lt;/responseData&gt;
              &lt;samplerData&gt;false&lt;/samplerData&gt;
              &lt;xml&gt;false&lt;/xml&gt;
              &lt;fieldNames&gt;true&lt;/fieldNames&gt;
              &lt;responseHeaders&gt;false&lt;/responseHeaders&gt;
              &lt;requestHeaders&gt;false&lt;/requestHeaders&gt;
              &lt;responseDataOnError&gt;true&lt;/responseDataOnError&gt;
              &lt;saveAssertionResultsFailureMessage&gt;true&lt;/saveAssertionResultsFailureMessage&gt;
              &lt;assertionsResultsToSave&gt;0&lt;/assertionsResultsToSave&gt;
              &lt;bytes&gt;true&lt;/bytes&gt;
              &lt;hostname&gt;true&lt;/hostname&gt;
              &lt;threadCounts&gt;true&lt;/threadCounts&gt;
              &lt;sampleCount&gt;true&lt;/sampleCount&gt;
            &lt;/value&gt;
          &lt;/objProp&gt;
          &lt;stringProp name=&quot;filename&quot;&gt;&lt;/stringProp&gt;
        &lt;/ResultCollector&gt;
        &lt;hashTree/&gt;
        &lt;ResultCollector guiclass=&quot;StatGraphVisualizer&quot; testclass=&quot;ResultCollector&quot; testname=&quot;Aggregate Graph&quot; enabled=&quot;true&quot;&gt;
          &lt;boolProp name=&quot;ResultCollector.error_logging&quot;&gt;false&lt;/boolProp&gt;
          &lt;objProp&gt;
            &lt;name&gt;saveConfig&lt;/name&gt;
            &lt;value class=&quot;SampleSaveConfiguration&quot;&gt;
              &lt;time&gt;true&lt;/time&gt;
              &lt;latency&gt;true&lt;/latency&gt;
              &lt;timestamp&gt;true&lt;/timestamp&gt;
              &lt;success&gt;true&lt;/success&gt;
              &lt;label&gt;true&lt;/label&gt;
              &lt;code&gt;true&lt;/code&gt;
              &lt;message&gt;true&lt;/message&gt;
              &lt;threadName&gt;true&lt;/threadName&gt;
              &lt;dataType&gt;false&lt;/dataType&gt;
              &lt;encoding&gt;false&lt;/encoding&gt;
              &lt;assertions&gt;true&lt;/assertions&gt;
              &lt;subresults&gt;false&lt;/subresults&gt;
              &lt;responseData&gt;false&lt;/responseData&gt;
              &lt;samplerData&gt;false&lt;/samplerData&gt;
              &lt;xml&gt;false&lt;/xml&gt;
              &lt;fieldNames&gt;true&lt;/fieldNames&gt;
              &lt;responseHeaders&gt;false&lt;/responseHeaders&gt;
              &lt;requestHeaders&gt;false&lt;/requestHeaders&gt;
              &lt;responseDataOnError&gt;true&lt;/responseDataOnError&gt;
              &lt;saveAssertionResultsFailureMessage&gt;true&lt;/saveAssertionResultsFailureMessage&gt;
              &lt;assertionsResultsToSave&gt;0&lt;/assertionsResultsToSave&gt;
              &lt;bytes&gt;true&lt;/bytes&gt;
              &lt;hostname&gt;true&lt;/hostname&gt;
              &lt;threadCounts&gt;true&lt;/threadCounts&gt;
              &lt;sampleCount&gt;true&lt;/sampleCount&gt;
            &lt;/value&gt;
          &lt;/objProp&gt;
          &lt;stringProp name=&quot;filename&quot;&gt;&lt;/stringProp&gt;
        &lt;/ResultCollector&gt;
        &lt;hashTree/&gt;
      &lt;/hashTree&gt;
    &lt;/hashTree&gt;
  &lt;/jmeterTestPlan&gt;
  </code></pre>