har-to-jmeter-convertor

February 24, 2026 ยท View on GitHub

har to jmeter convertor tool logo

Convert a HAR file to a JMeter script and a Record XML file.

Link to github project har-to-jmeter-convertor

har-to-jmeter-convertor

Convert a HAR (Http ARchive) file to a JMeter script and a Record XML file.

Maven Central Apache License Free Apache JMeter

An article about motivations to create this tool: https://dzone.com/articles/convert-a-har-file-to-jmeter-script

Creating a har file and run the tool har-to-jmx-convertor to simulate recording from the JMeter recording template

This tool har-to-jmx-convertor try to simulate a script JMeter and a record xml file recording from the JMeter recording template.

Since version 7.0, Websocket is manage with samplers from the plugin "WebSocket Samplers by Peter Doornbosch".

JMeter recording template and HTTP(S) Test Script Recorder - The standard way to record

This demonstration use the web site from : https://petstore.octoperf.com

The JMeter recording template :
JMeter recording template start

The result of recording with JMeter "HTTP(S) Test Script Recorder" :
JMeter script and record

HAR created on a Browser (e.g. Firefox) - The new way with the convertor tool

Record the navigation in the web application with Developper tool : Network and save exchanges in HAR file format :
Browser save HAR file

Launch the "Convertor tool" :
Step to create script and record from HAR file

Tool results : Open the script created and the record.xml in a View Results Tree
Open the script created

Standard HAR file created with Firefox, Chrome, Edge with external csv file for transaction information

You could add an external csv file that contains information about transaction name start and end.

Step to create script and record from HAR file and external csv file

The CSV format is :

  • Timestamp iso format GMT;TRANSACTION;transaction name;start for starting a new transaction
  • Timestamp iso format GMT;TRANSACTION;transaction name;stop for ending transaction the precedent transaction
  • Separator ";"
  • Charset UTF-8

E.g :

2024-05-06T12:39:58.711Z;TRANSACTION;login;start
2024-05-06T12:40:08.643Z;TRANSACTION;login;stop
2024-05-06T12:40:20.880Z;TRANSACTION;home;start
2024-05-06T12:40:37.634Z;TRANSACTION;home;stop

A simple tool named "create-external-file-for-har" create easily this csv file. https://github.com/vdaburon/create-external-file-for-har

You need to add the parameter and value : -external_file_infos c:/Temp/jpetstore.csv to set the csv file to read

External JSON file created with "HAR Transaction Marker" from LOADMAGIC.AI

You could add an external json file that contains information about transaction name start and end and timestamp.
Step to create script and record from HAR file and external json file

A Chrome plugin call "HAR Transaction Marker" from LOADMAGIC.AI, could generate an external JSON file with Transaction Names, timestamp (EPOC GMT ms), type start or stop
Use the "Har Transaction Marker Chrome Plugin to create Transaction Informations

This extension at Chrome Web Store: https://chromewebstore.google.com/search/HAR%20Transaction%20Marker

E.g: JSON content
"JSON file created  with Har Transaction Marker

The JSON need at least an array of "name", "type" ("start" or "end") and timestamp format 'EPOC GMT ms' (e.g:1771835429492) and UTF-8 encoded.

HAR created with BrowserUp Proxy

This tool is compatible with Har file generated with BrowserUp Proxy.

The BrowserUp Proxy create a har and could filter url or content (no binary).

The proxy client could be a browser or a client http in an application.

BrowserUp Proxy could be embedded in a java application or in Selenium java code application.

Step to create script and record from HAR file from BrowserUp

The BrowserUp Proxy active project is available at this url :
Goto the BrowserUp Proxy active project

Note : The BrowserMod Proxy tool is no more active (since september 2017) and it's recommended to migrate to BrowerUp proxy https://github.com/valfirst/browserup-proxy the "valfirst" GitHub username/project is important.

Websocket use the plugin "WebSocket Samplers by Peter Doornbosch"

If your Har file contains WebSocket Connection and Messages, set the parameter -ws_with_pdoornbosch true, this tool will try to create Websocket Samplers in the JMeter script generated and the exchanges in the Recording XML file.

Documentation at : https://bitbucket.org/pjtr/jmeter-websocket-samplers/src/master/

The HAR is record from Chrome Browser not Firefox Browser and not Egde Browser (research in har file the attribute : '_webSocketMessages').

Currently limitation to only one websocket connection and multi text messages (send or receive) in this websocket connection (binary message is not tested).

Text message could be on "STOMP" format (https://en.wikipedia.org/wiki/Streaming_Text_Oriented_Messaging_Protocol) or no "STOMP" (simple text).

Need the plugin "WebSocket Samplers by Peter Doornbosch" to open the generated script that contain Websocket Samplers.

This demonstration use the web site : https://websocket.org/tools/websocket-echo-server/

Script generated with Websocket samplers and xml record messages

Parameters

Parameters are :

  • har_in the HAR file to read (exported HAR from Web Browser : Chrome, Firefox, Edge ...)
  • jmx_out the file JMeter script generated
  • record_out create the record xml file from the har file (could be open with the Listener View Results Tree)
    e.g. record_out = record.xml
  • add_result_tree_record, add a View Result Tree to view the Recording XML File Generated (default true), the record_out must be not empty
  • filter_include, the regular expression matches the URL to Include (first filter)
  • filter_exclude, the regular expression matches the URL to Exclude (second filter)
    • default all = empty (no filter)
    • e.g. filter_exclude=https://notmysite.com/.*
    • or filter statics, filter_exclude=(?i).*\.(bmp|css|js|gif|ico|jpe?g|png|swf|eot|otf|ttf|mp4|woff|woff2|svg)
  • add_pause boolean, use with parameter new_tc_pause (default true), add Flow Control Action Pause
  • new_tc_pause time between 2 urls to create a new page (Transaction Controller)
    • e.g. 5000 for 5 sec between 2 urls
  • remove_cookie, remove header with cookie because use a Cookie Manager (default true)
  • remove_cache_request, remove request cache header because use a Cache Manager (default true)
  • remove_headers, remove a list of http headers (comma separator and case insensitive), e.g:"User-Agent,Pragma,X-TOKEN"
  • page_start_number, set the start page number for partial recording (default 1, must be an integer > 0)
  • sampler_start_number, set the start sampler number for partial recording (default 1, must be an integer > 0)
  • external_file_infos, external csv file or json file contains information about Timestamp, Transaction Name, start or end.
  • ws_with_pdoornbosch boolean, manage websocket messages with the JMeter plugin from Peter DOORNBOSH (default false), if true need the plugin 'WebSocket Samplers by Peter Doornbosch' to open the generated script.
  • jackson_parser_string_max, change default Jackson String length size (default integer size = 20000000), for processing very large JSON

Command line tool (CLI)

This tool could be use with script shell Windows or Linux.

Help to see all parameters :

C:\apache-jmeter\bin>java -jar har-to-jmeter-convertor-9.1-jar-with-dependencies.jar -help

usage: io.github.vdaburon.jmeter.har.HarForJMeter [-add_pause <add_pause>] [-add_result_tree_record
       <add_result_tree_record>] [-external_file_infos <external_file_infos>] [-filter_exclude <filter_exclude>]
       [-filter_include <filter_include>] -har_in <har_in> [-help] [-jackson_parser_string_max
       <jackson_parser_string_max>] -jmx_out <jmx_out> [-new_tc_pause <new_tc_pause>] [-page_start_number
       <page_start_number>] [-record_out <record_out>] [-remove_cache_request <remove_cache_request>] [-remove_cookie
       <remove_cookie>] [-remove_headers <remove_headers>] [-sampler_start_number <sampler_start_number>]
       [-ws_with_pdoornbosch <ws_with_pdoornbosch>]
io.github.vdaburon.jmeter.har.HarForJMeter
 -add_pause <add_pause>                                   Optional boolean, add Flow Control Action Pause after
                                                          Transaction Controller (default true)
 -add_result_tree_record <add_result_tree_record>         Optional boolean, add 'View Result Tree' to view the
                                                          record.xml file created (default true), record_out must be not
                                                          empty
 -external_file_infos <external_file_infos>               Optional, csv file or json contains external infos : timestamp
                                                          transaction name and start or end
 -filter_exclude <filter_exclude>                         Optional, regular expression to exclude url
 -filter_include <filter_include>                         Optional, regular expression to include url
 -har_in <har_in>                                         Har file to read (e.g : my_file.har)
 -help                                                    Help and show parameters
 -jackson_parser_string_max <jackson_parser_string_max>   Optional argument to increase (or decrease) the maximum
                                                          allowed document string for the Jackson Parser library (int
                                                          value), default is 20000000
 -jmx_out <jmx_out>                                       JMeter file created to write (e.g : script.jmx)
 -new_tc_pause <new_tc_pause>                             Optional, create new Transaction Controller after request ms,
                                                          same as jmeter property : proxy.pause, need to be > 0 if set.
                                                          Usefully for Har created by Firefox or Single Page Application
                                                          (Angular, ReactJS, VuesJS ...)
 -page_start_number <page_start_number>                   Optional, the start page number for partial recording (default
                                                          1)
 -record_out <record_out>                                 Optional, file xml contains exchanges likes recorded by JMeter
 -remove_cache_request <remove_cache_request>             Optional boolean, remove cache header in the http request
                                                          (default true because add a Cache Manager)
 -remove_cookie <remove_cookie>                           Optional boolean, remove cookie in http header (default true
                                                          because add a Cookie Manager)
 -remove_headers <remove_headers>                         Remove a list of headers (comma separator, case insensitive),
                                                          e.g:User-Agent,Pragma,X-TOKEN
 -sampler_start_number <sampler_start_number>             Optional, the start sampler number for partial recording
                                                          (default 1)
 -ws_with_pdoornbosch <ws_with_pdoornbosch>               Optional boolean, Manage websocket messages with the JMeter
                                                          plugin from Peter DOORNBOSH (default false), if true need the
                                                          plugin from Peter DOORNBOSH to open the generated script
E.g : java -jar har-for-jmeter-<version>-jar-with-dependencies.jar -har_in myhar.har -jmx_out scriptout.jmx -record_out
recording.xml -add_result_tree_record true -new_tc_pause 5000 -add_pause true -filter_include "https://mysite/.*"
-filter_exclude "https://notmysite/*" -page_start_number 50 -sampler_start_number 250 -ws_with_pdoornbosch false
-remove_headers "User-Agent,Pragma"
C:\apache-jmeter\bin>java -jar har-to-jmeter-convertor-10.0-jar-with-dependencies.jar -har_in "myhar.har" -jmx_out "script_out.jmx" -filter_include "https://mysite.com/.*" -filter_exclude "https://notmysite.com/.*" -add_pause true -new_tc_pause 5000
/var/opt/apache-jmeter/bin>java -jar har-to-jmeter-convertor-10.0--jar-with-dependencies.jar -har_in "myhar.har" -jmx_out "script_out.jmx" -record_out "record.xml" -add_pause true -new_tc_pause 5000

Usage Maven

The maven groupId, artifactId and version, this plugin is in the Maven Central Repository Maven Central

<groupId>io.github.vdaburon</groupId>
<artifactId>har-to-jmeter-convertor</artifactId>
<version>10.0</version>

License

Licensed under the Apache License, Version 2.0

Versions

Version 10.0 date 2026-02-23, External file could be a JSON file created with "HAR Transaction Marker" Chrome Plugin from LOADMAGIC.AI or a CSV file.

Version 9.1 date 2026-02-03, Remove parameter use_lrwr_infos because the LoadRunner plugin HarGeneratorChrome for Chrome doesn't work with new Chrome security for plugins.

Version 9.0 date 2026-02-03, Add new parameter -jackson_parser_string_maxAdd parameter to change default Jackson String length size (default integer size = 20000000) -jackson_parser_string_max 50000000, Pull Request https://github.com/vdaburon/har-to-jmeter-convertor/pull/3

Version 8.0 date 2025-11-22, Add new parameter -remove_headers remove a list of http headers (comma separator, case insensitive), e.g: -remove_headers "User-Agent,Pragma,X-TOKEN".

Version 7.1 date 2025-03-27, Remove request headers from HTTP/2, these headers start with ':' likes ":authority", ":method", ":path" or ":scheme". Don't create httpSampler for url "data:".

Version 7.0 date 2025-02-27, Manage the websocket messages with 'WebSocket Samplers by Peter Doornbosch', add new boolean parameter 'ws_with_pdoornbosch' (default false).

Version 6.1 date 2025-01-28, correct a NullPointerException when creating the Recording XML file

Version 6.0 date 2024-09-19, add 'HTTP(S) Test Script Recorder' and 'View Results Tree' to view the Record.xml file created. Correct save file no url encoded name.

Version 5.3 date 2024-09-13, correct PUT with no parameter, no content and mime-type == null

Version 5.2 date 2024-06-20, correct extract parameters for mime type "form-urlencoded" ended with charset likes "application/x-www-form-urlencoded; charset=xxx"

Version 5.1 date 2024-05-15, compatible with har generated by browsermob-proxy tool (https://github.com/lightbody/browsermob-proxy) and csv external_file_infos contains transaction infos.

Version 5.0 date 2024-05-10, add an external csv file with transaction information for JMeter Transaction Controller Name. New parameter : -external_file_infos transaction_infos.csv. Correct Filter Include first filter and Filter Exclude second filter.

Version 4.0 date 2024-05-06, could read har file generated with the LoadRunner Web Recorder Chrome Extension that contains transaction name for JMeter Transaction Controller Name. New parameter -use_lrwr_infos transaction_name

Version 2.3 date 2024-03-30, encode value for x-www-form-urlencoded when value contains space ' ' or equal '=' or slash '/' or plus '+' characters. Correct add the content for body data for POST, PUT or PATCH if not x-www-form-urlencoded in the Record.xml file.

Version 2.2 date 2024-03-29, remove the header 'Content-length' because the length is computed by JMeter when the request is created. POST or PUT could have query string and body with content so add query string to the path. Set Content Encoding to UFT-8 for POST or PUT method and request Content-Type : application/json. Add body data content in Record.xml for PUT and PATCH methods.

Version 2.1 date 2024-03-13, change the version in the code and the comment for the test plan. Use the extension to find is response is text or bin.

Version 2.0 date 2024-03-12, for POST multipart/form-data don't put the content of the file in the Record.xml file because binary content could be large and not XML compatible, add parameters : page_start_number and sampler_start_number to facilitate partial recording of website navigation.

Version 1.0 date 2024-03-11, First Release.