package_json_parser

Crates.iopackage_json_parser
lib.rspackage_json_parser
version
sourcesrc
created_at2025-04-13 14:51:46.311601+00
updated_at2025-04-13 15:26:38.48244+00
descriptionA parser for package.json
homepage
repositoryhttps://github.com/ityuany/package_json_parser
max_upload_size
id1631870
Cargo.toml error:TOML parse error at line 24, column 1 | 24 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
ityuany (ityuany)

documentation

README

package_json_parser

Crates.io Documentation License: MIT

A Rust library for parsing and validating package.json files.

Features

  • Parse package.json files with strong type safety
  • Validate package.json fields according to npm specifications
  • Error handling with detailed error messages
  • Efficient parsing with optimized dependencies

Installation

Add this to your Cargo.toml:

[dependencies]
package_json_parser = "0.0.1"

Usage

use package_json_parser::PackageJson;

fn main() {
    let json_str = r#"
    {
        "name": "my-package",
        "version": "1.0.0",
        "dependencies": {
            "some-package": "^1.0.0"
        }
    }
    "#;

    match PackageJson::from_str(json_str) {
        Ok(package) => {
            println!("Package name: {}", package.name);
            println!("Version: {}", package.version);
        }
        Err(e) => println!("Error parsing package.json: {}", e),
    }
}

Documentation

For detailed documentation, please visit docs.rs.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Commit count: 0

cargo fmt