GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together. Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Work fast with our official CLI. Learn more. If nothing happens, download GitHub Desktop and try again. If nothing happens, download Xcode and try again.
If nothing happens, download the GitHub extension for Visual Studio and try again. Parse and stringify URL query strings. My open source work is supported by the community. This module targets Node. If you want support for older browsers, or, if your project is using create-react-app v1, use version 5: npm install query-string 5. Parse a query string into an object.
The returned object is created with Object. Decode the keys and values. URL components are decoded with decode-uri-component. Supports both Function as a custom sorting function or false to disable sorting. Strictly encode URI components with strict-uri-encode. It uses encodeURIComponent if set to false. You probably don't care about this option. URL encode the keys and values. If omitted, keys are sorted using Array sort , which means, converting them to strings and comparing strings in Unicode code point order.
If the parseFragmentIdentifier option is true , the object will also contain a fragmentIdentifier property. Stringify an object into a URL with a query string and sorting the keys.
The inverse of. Query items in the query property overrides queries in the url property. The fragmentIdentifier property overrides the fragment identifier in the url property. This module intentionally doesn't support nesting as it's not spec'd and varies between implementations, which causes a lot of edge cases.
Sometimes you want to unset a key, or maybe just make it present without assigning a value to it. Here is how falsy values are stringified:. The maintainers of query-string and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications.
Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. We use optional third-party analytics cookies to understand how you use GitHub. You can always update your selection by clicking Cookie Preferences at the bottom of the page. For more information, see our Privacy Statement. We use essential cookies to perform essential website functions, e.
We use analytics cookies to understand how you use our websites so we can make them better, e. Skip to content. Dismiss Join GitHub today GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up. GitHub is where the world builds software Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world. Sign up for free Dismiss. Go back. Launching Xcode If nothing happens, download Xcode and try again.
Latest commit. Git stats commits. Failed to load latest commit information. Tidelift tasks. May 31, When only receiving values with encoded array value, decode values Oct 17, Meta tweaks. Jul 22, Oct 2, Jun 3, Add benchmarks Apr 27, Nov 5, Jun 6, View code. About Parse and stringify URL query strings Topics query-string urlsearchparams url stringify parse npm-package.
MIT License. Releases 65 v6. Sponsor this project. Packages 0 No packages published. Used by 3. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Accept Reject. Essential cookies We use essential cookies to perform essential website functions, e. Analytics cookies We use analytics cookies to understand how you use our websites so we can make them better, e. Save preferences.