If you’re load testing a JSON web service, or something similar, it’s important to validate that the responses coming back are of a valid JSON format and are structured correctly. Furthermore, it’s often important to look for certain pieces of data in the response to make sure it’s correct.
The important thing about validation functions is that they’re expected to return a boolean value:
true if the
response is valid, and
false if it’s invalid. In the above example, we’re only considering the response valid if the
response is a JSON array with at least 1 item, and the first item has a
firstName of “Alice”.
You can read more about validation in Loadster, and other types of validators, in Validation Rules.
JSON parsing also works in Capturing Rules.