How do I compare two different JSONs
This example demonstrates comparing two different JSONs.
In the solution shown below, the two JSON objects are stored into the variables using "store" command and compared using "jsonCompare" command. The result is stored into a variable. The command returns "1" if the JSONs are similar, else it returns "0".
Note: The notation to reuse the value of the variable in Worksoft SaaS is ${<Variable Name>}.
Solution:
Tips, Tricks, Gotchas & Best Practices:
- You can also call both the JSON objects directly in the "Target" field separated by "||" symbol in "jsonCompare" command instead of storing them into a variable.
- As a best practice, it is always advisable to define the variable names without any spaces and if you want to differentiate the words, use underscores.