jmeterjmeter-plugins

JMeter - How to read JSON file?


I used the CSV format for the data files in JMeter. Our VP wants to change the format to JSON. How can I read a JSON file from the disk?


Solution

  • You have at least 2 options:

    1. Use HTTP Request sampler and file protocol like:

      HTTP Request File Protocol

      JSON files are basically plain-text files so you will be able to use JSON Extractor or JSON Path Extractor to parse JSON data and store the result into JMeter Variables for later reuse

      References:

    2. Use JSR223 Test Elements and Groovy language. Groovy has built-in JSON support via JsonSlurper so you will be able to parse the JSON file programmatically.

      References: