{"id":22361322,"url":"https://github.com/kei-k23/query-string","last_synced_at":"2026-01-27T15:33:07.849Z","repository":{"id":257403960,"uuid":"858167663","full_name":"Kei-K23/query-string","owner":"Kei-K23","description":"Parse and stringify URL query strings in a fantastic way 🚀","archived":false,"fork":false,"pushed_at":"2024-09-18T12:28:43.000Z","size":13,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-30T14:25:14.151Z","etag":null,"topics":["crate","querystring","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kei-K23.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-16T12:33:46.000Z","updated_at":"2024-10-21T02:29:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"d92c44f5-a428-48ba-aee9-7f9741f65804","html_url":"https://github.com/Kei-K23/query-string","commit_stats":null,"previous_names":["kei-k23/query-string"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Kei-K23/query-string","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kei-K23%2Fquery-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kei-K23%2Fquery-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kei-K23%2Fquery-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kei-K23%2Fquery-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kei-K23","download_url":"https://codeload.github.com/Kei-K23/query-string/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kei-K23%2Fquery-string/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28815408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T12:25:15.069Z","status":"ssl_error","status_checked_at":"2026-01-27T12:25:05.297Z","response_time":168,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crate","querystring","rust"],"created_at":"2024-12-04T16:29:19.597Z","updated_at":"2026-01-27T15:33:07.834Z","avatar_url":"https://github.com/Kei-K23.png","language":"Rust","readme":"# query-string\n\nParse and stringify URL query strings in a fantastic way.\n\n## Features\n\n- **URL Encoding**: Encodes characters that are not part of the unreserved set (`A-Z`, `a-z`, `0-9`, `-`, `_`, `.`, `~`) and properly handles multi-byte UTF-8 characters.\n- **URL Decoding**: Decodes percent-encoded characters back to their original form.\n- **Query String Parsing**: Parses a query string into a `HashMap` of key-value pairs.\n- **Query String Stringifying**: Converts a `HashMap` of key-value pairs back into a query string.\n\n## Installation\n\n### Install with Cargo CLI:\n\n```bash\ncargo add query_string\n```\n\nor\n\n### Add this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nquery_string = \"0.1.0\"\n```\n\n## Usage\n\n### Encoding\n\nThe encode function encodes any character that is not part of the unreserved set and handles multi-byte UTF-8 characters.\n\n```rs\nuse your_crate_name::encode;\n\nfn main() {\n    let input = \"Hello World! こんにちは\";\n    let encoded = encode(input);\n    println!(\"{}\", encoded); // Output: Hello%20World%21%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF\n}\n```\n\n### Decoding\n\nThe decode function decodes a percent-encoded string.\n\n```rs\nuse your_crate_name::decode;\n\nfn main() -\u003e std::io::Result\u003c()\u003e {\n    let encoded = \"Hello%20World%21%E3%81%93%E3%82%93%E3%81%AB%E3%81%A1%E3%81%AF\";\n    let decoded = decode(encoded)?;\n    println!(\"{}\", decoded); // Output: Hello World! こんにちは\n    Ok(())\n}\n```\n\n### Query String Parsing\n\nThe parse function parses a query string into a `HashMap\u003cString, String\u003e`.\n\n```rs\nuse your_crate_name::parse;\n\nfn main() {\n   use query_string::parse;\n\nfn main() {\n    let query = \"?foo=bar\u0026foo=baz\u0026name=John\u0026age=30\";\n    let parsed = parse(query);\n\n    for (key, values) in \u0026parsed {\n        println!(\"{}: {:?}\", key, values);\n    }\n    // Output:\n    // foo: [\"bar\", \"baz\"]\n    // name: [\"John\"]\n    // age: [\"30\"]\n}\n}\n```\n\n### Query String Stringifying\n\nThe stringify function converts a `HashMap\u003cString, String\u003e` into a query string.\n\n```rs\nuse std::collections::HashMap;\nuse your_crate_name::stringify;\n\nfn main() {\n    let mut params = HashMap::new();\n    params.insert(\"name\".to_string(), \"John\".to_string());\n    params.insert(\"age\".to_string(), \"30\".to_string());\n    params.insert(\"city\".to_string(), \"New York\".to_string());\n\n    let query_string = stringify(\u0026params);\n    println!(\"{}\", query_string); // Output: name=John\u0026age=30\u0026city=New York\n}\n```\n\n## Functions\n\n### `encode(input: \u0026str) -\u003e String`\n\nEncodes the input string using percent-encoding. Reserved characters and non-ASCII characters are encoded as %XX, where XX is the hexadecimal representation of the byte.\n\n### `decode(input: \u0026str) -\u003e io::Result\u003cString\u003e`\n\nDecodes a percent-encoded string. Returns an error if the input contains invalid percent-encoded sequences.\n\n### `parse(query: \u0026str) -\u003e HashMap\u003cString, Vec\u003cString\u003e\u003e`\n\nParses a URL query string into a `HashMap\u003cString, Vec\u003cString\u003e\u003e`. Handles removing unnecessary characters like ?, #, and ! from the query string before parsing.\n\n### `stringify(params: \u0026HashMap\u003cString, String\u003e) -\u003e String`\n\nConverts a HashMap\u003cString, String\u003e into a query string format, where key-value pairs are joined by = and separated by \u0026.\n\n## Contribution\n\nAll contribution are welcome. Please create issue or make PR for bugs, issues or new features. Please feel free to reach out for detail information of the project.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](/LICENSE) file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkei-k23%2Fquery-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkei-k23%2Fquery-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkei-k23%2Fquery-string/lists"}