how to check response field is sorted asc or desc

NeilNeil Posts: 38
edited December 2016 in SOAtest

Hi All,

type: REST API, method: GET
My JSON response contains list of documents, In which I have file size field. I can send a parameter in request to get all the documents sorted ASC or DESC on filesize.

I want to read the file size in response and check the order is ASC or DESC.

Thanks in advance.



  • Ramiro MartinezRamiro Martinez Posts: 51 admin

    Hi Neil,

    Have you tried the XML/JSON assertor with a numeric assertion?
    The numeric assertion has the options '<', '>', and other comparison options.

    For your use case, I suggest data banking the values you need to compare and then calling them in the XML assertor.
    Due to visibility restraints you will need to call the variables manually using:
    I suggest changing the variable to make it easier to call the values.

    Short example below:

    Best regards,

    Ramiro Martinez

  • NeilNeil Posts: 38

    Thank you so much Ramiro Martinez ,I think this logic will help. I will try this.
    but I also have to validate other sorting.

    The solution you gave works for numeric.

    1) How about if we have to validate filename field is ASC or DESC?
    2) How to validate if date is ASC or DESC order?

    any thoughts? please let me know.

    Thanks again.

Sign In or Register to comment.