Forum Discussion

InekeBauw's avatar
InekeBauw
Occasional Contributor
7 years ago

Looking for extra json elements in response payload

Hi everyone,

 

I'm looking for a way to check if there are no extra elements in my response payload. 

I do an JSON existing match on all the elements, but also need to check if no extra element is added in the response payload.

 

How can I do this? 

 

Thanks in advance and kind regards

 

4 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Well, it would help if you can provide source and target data (need not be exact), at least resembling your data structure.
    • InekeBauw's avatar
      InekeBauw
      Occasional Contributor

      For example this is an response payload of a PUT. 

      So if there is an extra element then these two, test should fail.

       

      {
      "ExternalReference": "Testing6",
      "ErrorLog": []
      }

      • nmrao's avatar
        nmrao
        Champion Level 3
        Is the provided response structure is same as your original response? does it have any recursive? Because, solution would be completely relate to data. If data differs, solution would differ.