JSON and XML: Editing Structured Content¶
Modern web applications and APIs use JSON and XML to send structured data in HTTP requests. Load Tester automatically recognizes JSON and XML content and breaks it down into editable fields.
Automatic JSON Recognition (v4.3+)¶
Starting with Load Tester 4.3, Load Tester automatically recognizes JSON content in any HTTP request. Each JSON element becomes a configurable name-value pair field in the Fields View.
Example JSON in a POST request:
In the Fields View, you'll see:
customer_id=12345address_id=67890address=123 Main St
Each field can be configured with a different datasource (constant, dataset, user variable, script).
ASM Auto-Configuration for JSON¶
Whenever Load Tester's Application State Management (ASM) tool runs, it searches for incoming name-value pairs (in JSON responses) that have matching outgoing name-value pairs (in JSON requests).
When ASM detects a match, it automatically configures the test case to:
- Extract the value from the JSON response
- Store it in user state
- Inject it into subsequent JSON requests
This works for:
- JSON numbers
- JSON strings
JSON Auto-Configuration Limitations
While other types of auto-configuration performed by Load Tester are highly reliable, the correctness of auto-configuration in JSON content cannot in general be guaranteed. Automatically configured JSON fields will be incorrect in a handful of situations.
When to verify JSON configuration manually:
- Complex nested JSON structures
- JSON arrays with variable-length content
- Fields with the same name but different meanings in different contexts
Always run a replay after ASM and verify that JSON requests contain the correct values.
Manual JSON Field Configuration¶
If Load Tester doesn't automatically recognize JSON content (e.g., JSON hidden inside a query parameter), you can manually mark any field as JSON content:
- Open Fields View and select the transaction with JSON
- Double-click the field containing JSON content
- In Field Assignment dialog, select Parsers tab
- Choose parser: JSON
- Click: OK
Load Tester now treats that field's content as JSON, breaking it down into editable sub-fields.
XML Auto-Configuration¶
Load Tester automatically recognizes XML content in HTTP requests and responses, just like JSON.
XML elements appear in Fields View as name-value pairs, and ASM automatically correlates XML values between responses and requests.
Example XML in a SOAP request:
<soap:Envelope>
<soap:Body>
<GetCustomer>
<customerId>12345</customerId>
<sessionToken>abc-def-ghi</sessionToken>
</GetCustomer>
</soap:Body>
</soap:Envelope>
In the Fields View:
customerId=12345sessionToken=abc-def-ghi
If sessionToken was provided by the server in an earlier response, ASM will automatically configure extraction and correlation.
XML Automation (v5.0+)
Load Tester PRO 5.0 introduced automatic XML recognition and auto-configuration, making it much easier to configure SOAP web service tests and other XML-based applications. ASM handles XML correlation just like it handles form fields and JSON content.
Best Practice: Verify JSON/XML Auto-Configuration After ASM¶
Why: JSON/XML auto-correlation is not guaranteed to be correct in all situations.
How: After running ASM, run a small replay and check Fields View to verify JSON request fields contain correct dynamic values from previous responses.
Troubleshooting¶
JSON Fields Not Appearing in Fields View¶
Symptom: JSON content in request body, but Fields View doesn't show individual JSON fields.
Likely causes:
- Content-Type header incorrect (not
application/json) - JSON hidden inside another field (query parameter, form field)
- Malformed JSON (syntax error)
Solution:
- Check Content-Type: Headers View → Verify Content-Type is
application/json - Manually mark as JSON: Fields View → Double-click field → Parsers tab → Select JSON
- Validate JSON syntax: Copy JSON to online validator to check for syntax errors
ASM Doesn't Correlate JSON Values¶
Symptom: ASM runs successfully, but JSON fields that should be correlated aren't auto-configured.
Likely causes:
- Field names don't match exactly between response and request
- Values are JSON arrays or objects (ASM only correlates strings and numbers)
- Complex nested structures confuse auto-correlation
Solution:
- Check field names: Fields View → Compare field names in response vs. request (must match exactly)
- Configure manually: Create extractor for response value, link to request field using user variable
- Simplify JSON structure: If possible, flatten nested structures