Convert a HTTP Archive (HAR) file to a CSV (or TSV) using jq. Script heavily inspired by Google's har2csv (which requires node) by Ayman Farhat, and also a passing comment by Andy Davies.
The script ignores fields that are not essential for analyzing requests/responses such as content and those that might carry private information such as cookies.
# Install jq
$ brew install jq
# Clone the repo, make sure scripts are executable
$ chmod +x har2csv.jq
$ chmod +x har2tsv.jq
# Run CSV
$ ./har2csv.jq input.har > output.csv
# Run TSV
$ ./har2tsv.jq input.har > output.tsvExample using Chrome:
- Open the Dev Tools panel via Ctrl + Shift + i
- Click the “Network” menu item on the top menu bar of the panel
- The HTTP session is recorded by default, navigate to the pages / resources you're inspecting
- Once ready to export the data, right-click anywhere on the list of items in the Network resource list and select “Save all as HAR with content”
| Entry path | CSV column name |
|---|---|
| pageref | pageRef |
| startedDateTime | startedDateTime |
| request.method | requestMethod |
| request.url | requestUrl |
| request.httpVersion | requestHttpVersion |
| request.headerSize | requestHeaderSize |
| request.bodySize | requestBodySize |
| response.status | responseStatus |
| response.content.size | responseContentSize |
| response.content.compression | responseContentSizeCompression |
| response.content._transferSize | responseTransferSize |
| response.headers.name['content-type'] | responseContentType |
| response.headers.name['content-length'] | responseContentLength |
| response.headers.name['cache-control'] | responseCacheControl |
| time | time |
| timings.blocked | blocked |
| timings.dns | dns |
| timings.connect | connect |
| timings.ssl | ssl |
| timings.send | send |
| timings.wait | wait |
| timings.receive | receive |
| timings._blocked_queuing | blockedqueueing |
Note: Entries that don't match the above fields / paths are not included in the result CSV/TSV files
Unless stated otherwise, the codebase is released under the MIT License. This covers both the codebase and any sample code in the documentation.