#serialization #yaml #deserialize

har

A HTTP Archive format (HAR) serialization & deserialization library

12 releases (breaking)

Uses new Rust 2024

0.9.0 Mar 22, 2026
0.8.1 Oct 15, 2024
0.8.0 Jan 8, 2023
0.7.1 Oct 18, 2021
0.1.0 Nov 16, 2018

#267 in Parser implementations

Download history 8946/week @ 2026-04-19 9513/week @ 2026-04-26 8702/week @ 2026-05-03 8513/week @ 2026-05-10 8698/week @ 2026-05-17 8026/week @ 2026-05-24 7684/week @ 2026-05-31 6330/week @ 2026-06-07 7249/week @ 2026-06-14 7964/week @ 2026-06-21 7978/week @ 2026-06-28 8324/week @ 2026-07-05 7410/week @ 2026-07-12 6599/week @ 2026-07-19 3882/week @ 2026-07-26 4824/week @ 2026-08-02

23,550 downloads per month
Used in 23 crates (12 directly)

MIT license

25KB
554 lines

har-rs

HTTP Archive format (HAR) serialization & deserialization library, written in Rust.

CI Latest version Documentation License

Install

JSON-only use (default):

[dependencies]
har = "0.9"

Enable YAML serialization:

[dependencies]
har = { version = "0.9", features = ["yaml"] }

Use

HAR input is always parsed from JSON. JSON serialization is available by default. YAML serialization through to_yaml is available only when the yaml feature is enabled.

use har::{from_str, to_json, HarVersion};

fn main() -> Result<(), har::Error> {
    let input = r#"{
        "log": {
            "version": "1.2",
            "creator": { "name": "example", "version": "1.0" },
            "entries": []
        }
    }"#;

    let har = from_str(input)?;
    assert_eq!(har.version(), HarVersion::V1_2);

    println!("{}", to_json(&har)?);
    Ok(())
}

With the yaml feature enabled, you can also serialize parsed HAR documents as YAML:

use har::{from_str, to_yaml};

fn main() -> Result<(), har::Error> {
    let input = r#"{
        "log": {
            "version": "1.2",
            "creator": { "name": "example", "version": "1.0" },
            "entries": []
        }
    }"#;

    let har = from_str(input)?;
    println!("{}", to_yaml(&har)?);
    Ok(())
}

See docs.rs/har for the full library API documentation.

Contribute

This project follows semver and conventional commits. CI runs on GitHub Actions, and releases are prepared and published with release-plz on master.

See CHANGELOG.md for release history.

Note

Inspired by softprops/openapi.

Dependencies

~1.6–3MB
~65K SLoC