Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Comparing Json Responses

Options
praharshithsoa
praharshithsoa Posts: 8

Consider I have 3 products with some requirments like colour and price . Initially they are in order P1 : {c1:p1} , P2 : {c2:p2} and P3 : {c3:p3} (Captured response). But from the server they are coming in order P2 , P1 and P3. Is there any way to compare these two responses in diff tool by ignoring order change ?

Comments

  • jakubiak
    jakubiak Posts: 801 admin
    Options

    The XML mode of Diff Tool has a mode to ignore element order. If the response is XML, you can simply use that mode in Diff Tool. If the response is not XML, you could convert it to XML using the XML Converter Tool and then use Diff Tool in XML mode.

  • praharshithsoa
    praharshithsoa Posts: 8
    Options

    Hi @jakubiak ,

    Whatever you suggested is working fine , but still some times even though i convert that to xml and then trying to compare, I am still getting some order change (4 out of 10 times). Is there any chance to ignore that too ?

  • jakubiak
    jakubiak Posts: 801 admin
    Options

    It's hard to say without knowing more about your document. You could consider using the XML Sort tool (https://docs.parasoft.com/display/SOAVIRT9107/XML+Sort) in between converting to XML and using the Diff Tool, which will give you more control for how to control the sort.