Automate and facilitate JSON handling
JSON format is often used for serializing and transmitting structured data between the client and server parts of a web application. If your application uses JSON, the Module for JSON format can provide the following benefits for you.
• Easy to read formatted representation of JSON messages.
• Additional JPath function to extract values from JSON messages. This function is similar to the standard XPath function used with XML.
• Ability to create JSON messages containing dynamic values taken from variables.
• Automatic parameterization of session-specific values inside JSON messages.
The last feature is very important in case you have a high number of different values passed as a JSON structure.
Automatic JSON parameterization in action
When WAPT finds a session-specific value in a JSON message received from the server, it creates a variable named JSONAutoVarXX. Such variables are assigned with help of a special JPath function. It extracts the value from the message by its path. The variable is inserted in all subsequent requests instead of the original value.
The following example shows how a variable was created for the SessionId value.
In all subsequent requests the originally recorded value was replaced with that variable. Each new session will be assigned a different SessionId by the server. It will be extracted to the JSONAutoVar01 variable and passed back to the server.
If we record the same scenario without the module, the automatic parameterization will not work for such values. As a result, all emulated sessions will pass the originally recorded outdated SessionId value, which will result in an error, because the site expects a different value for each new session.