A robust utility for parsing and stringifying URL query strings with extensive formatting and type conversion options.
query-string is a JavaScript library for parsing and stringifying URL query strings. It converts URL query parameters (like `?foo=bar&baz=qux`) into JavaScript objects and vice versa, handling encoding, array formats, and type conversion. It solves the problem of manually dealing with the complexities of URL query string manipulation in web applications.
JavaScript developers building web applications that need to read, write, or manipulate URL query parameters, especially those requiring advanced formatting options or type-safe parsing.
Developers choose query-string for its extensive feature set beyond the native `URLSearchParams`, including support for multiple array formats, explicit type conversion, and utilities for URL manipulation, all in a lightweight, well-maintained package.
Parse and stringify URL query strings
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports multiple array formats including bracket, index, comma, and custom separators, allowing seamless integration with various server-side conventions without manual string manipulation.
Offers automatic parsing of numbers and booleans via options like parseNumbers and parseBooleans, plus a types schema for explicit parameter typing, ensuring accurate data types from query strings.
Includes methods like parseUrl, stringifyUrl, pick, and exclude for direct URL manipulation, simplifying tasks such as filtering query parameters or combining URLs with query objects.
Handles strict URI component encoding and decoding with customizable options, ensuring compatibility across different environments and preventing common encoding errors.
Intentionally lacks support for nesting objects in query strings, forcing developers to serialize nested data to JSON strings, which can be cumbersome for complex data structures.
Adds an external library dependency where native URLSearchParams might suffice for basic operations, potentially increasing bundle size and maintenance overhead unnecessarily.
With numerous options for array formats, sorting, and type conversion, the API can be overwhelming and error-prone for developers who only need straightforward query string handling.