{"id":13447613,"url":"https://github.com/sindresorhus/query-string","last_synced_at":"2025-05-12T18:46:03.898Z","repository":{"id":37677292,"uuid":"14375002","full_name":"sindresorhus/query-string","owner":"sindresorhus","description":"Parse and stringify URL query strings","archived":false,"fork":false,"pushed_at":"2025-03-18T15:40:41.000Z","size":253,"stargazers_count":6837,"open_issues_count":31,"forks_count":454,"subscribers_count":30,"default_branch":"main","last_synced_at":"2025-05-01T08:37:16.879Z","etag":null,"topics":["npm-package","parse","query-string","stringify","url","urlsearchparams"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/sindresorhus.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":".github/security.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"sindresorhus","open_collective":"sindresorhus","buy_me_a_coffee":"sindresorhus","custom":"https://sindresorhus.com/donate"}},"created_at":"2013-11-13T20:06:27.000Z","updated_at":"2025-04-29T22:18:50.000Z","dependencies_parsed_at":"2023-09-27T09:48:52.083Z","dependency_job_id":"981180fc-2513-453e-a02d-137191afc1e5","html_url":"https://github.com/sindresorhus/query-string","commit_stats":{"total_commits":253,"total_committers":78,"mean_commits":"3.2435897435897436","dds":0.3952569169960475,"last_synced_commit":"9fce3f9245d3fa1915c4a824738cd1edb76a6c85"},"previous_names":[],"tags_count":83,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fquery-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fquery-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fquery-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sindresorhus%2Fquery-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sindresorhus","download_url":"https://codeload.github.com/sindresorhus/query-string/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251914949,"owners_count":21664453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["npm-package","parse","query-string","stringify","url","urlsearchparams"],"created_at":"2024-07-31T05:01:22.382Z","updated_at":"2025-05-05T15:51:11.460Z","avatar_url":"https://github.com/sindresorhus.png","language":"JavaScript","readme":"# query-string\n\n\u003e Parse and stringify URL [query strings](https://en.wikipedia.org/wiki/Query_string)\n\n## Install\n\n```sh\nnpm install query-string\n```\n\n\u003e [!WARNING]\n\u003e Remember the hyphen! Do not install the deprecated [`querystring`](https://github.com/Gozala/querystring) package!\n\nFor browser usage, this package targets the latest version of Chrome, Firefox, and Safari.\n\n## Usage\n\n```js\nimport queryString from 'query-string';\n\nconsole.log(location.search);\n//=\u003e '?foo=bar'\n\nconst parsed = queryString.parse(location.search);\nconsole.log(parsed);\n//=\u003e {foo: 'bar'}\n\nconsole.log(location.hash);\n//=\u003e '#token=bada55cafe'\n\nconst parsedHash = queryString.parse(location.hash);\nconsole.log(parsedHash);\n//=\u003e {token: 'bada55cafe'}\n\nparsed.foo = 'unicorn';\nparsed.ilike = 'pizza';\n\nconst stringified = queryString.stringify(parsed);\n//=\u003e 'foo=unicorn\u0026ilike=pizza'\n\nlocation.search = stringified;\n// note that `location.search` automatically prepends a question mark\nconsole.log(location.search);\n//=\u003e '?foo=unicorn\u0026ilike=pizza'\n```\n\n## API\n\n### .parse(string, options?)\n\nParse a query string into an object. Leading `?` or `#` are ignored, so you can pass `location.search` or `location.hash` directly.\n\nThe returned object is created with [`Object.create(null)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create) and thus does not have a `prototype`.\n\n#### options\n\nType: `object`\n\n##### decode\n\nType: `boolean`\\\nDefault: `true`\n\nDecode the keys and values. URL components are decoded with [`decode-uri-component`](https://github.com/SamVerschueren/decode-uri-component).\n\n##### arrayFormat\n\nType: `string`\\\nDefault: `'none'`\n\n- `'bracket'`: Parse arrays with bracket representation:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo[]=1\u0026foo[]=2\u0026foo[]=3', {arrayFormat: 'bracket'});\n//=\u003e {foo: ['1', '2', '3']}\n```\n\n- `'index'`: Parse arrays with index representation:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo[0]=1\u0026foo[1]=2\u0026foo[3]=3', {arrayFormat: 'index'});\n//=\u003e {foo: ['1', '2', '3']}\n```\n\n- `'comma'`: Parse arrays with elements separated by comma:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo=1,2,3', {arrayFormat: 'comma'});\n//=\u003e {foo: ['1', '2', '3']}\n```\n\n- `'separator'`: Parse arrays with elements separated by a custom character:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo=1|2|3', {arrayFormat: 'separator', arrayFormatSeparator: '|'});\n//=\u003e {foo: ['1', '2', '3']}\n```\n\n- `'bracket-separator'`: Parse arrays (that are explicitly marked with brackets) with elements separated by a custom character:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo[]', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e {foo: []}\n\nqueryString.parse('foo[]=', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e {foo: ['']}\n\nqueryString.parse('foo[]=1', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e {foo: ['1']}\n\nqueryString.parse('foo[]=1|2|3', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e {foo: ['1', '2', '3']}\n\nqueryString.parse('foo[]=1||3|||6', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e {foo: ['1', '', 3, '', '', '6']}\n\nqueryString.parse('foo[]=1|2|3\u0026bar=fluffy\u0026baz[]=4', {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e {foo: ['1', '2', '3'], bar: 'fluffy', baz:['4']}\n```\n\n- `'colon-list-separator'`: Parse arrays with parameter names that are explicitly marked with `:list`:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo:list=one\u0026foo:list=two', {arrayFormat: 'colon-list-separator'});\n//=\u003e {foo: ['one', 'two']}\n```\n\n- `'none'`: Parse arrays with elements using duplicate keys:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo=1\u0026foo=2\u0026foo=3');\n//=\u003e {foo: ['1', '2', '3']}\n```\n\n##### arrayFormatSeparator\n\nType: `string`\\\nDefault: `','`\n\nThe character used to separate array elements when using `{arrayFormat: 'separator'}`.\n\n##### sort\n\nType: `Function | boolean`\\\nDefault: `true`\n\nSupports both `Function` as a custom sorting function or `false` to disable sorting.\n\n##### parseNumbers\n\nType: `boolean`\\\nDefault: `false`\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo=1', {parseNumbers: true});\n//=\u003e {foo: 1}\n```\n\nParse the value as a number type instead of string type if it's a number.\n\n##### parseBooleans\n\nType: `boolean`\\\nDefault: `false`\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('foo=true', {parseBooleans: true});\n//=\u003e {foo: true}\n```\n\nParse the value as a boolean type instead of string type if it's a boolean.\n\n##### types\n\nType: `object`\\\nDefault: `{}`\n\nSpecify a pre-defined schema to be used when parsing values. The types specified will take precedence over options such as: `parseNumbers`, `parseBooleans`, and `arrayFormat`.\n\nUse this feature to override the type of a value. This can be useful when the type is ambiguous such as a phone number.\n\nIt is possible to provide a custom function as the parameter type. The parameter's value will equal the function's return value.\n\nSupported Types:\n\n- `'string'`: Parse `phoneNumber` as a string (overriding the `parseNumbers` option):\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?phoneNumber=%2B380951234567\u0026id=1', {\n\tparseNumbers: true,\n\ttypes: {\n\t\tphoneNumber: 'string',\n\t}\n});\n//=\u003e {phoneNumber: '+380951234567', id: 1}\n```\n\n- `'number'`:  Parse `age` as a number (even when `parseNumbers` is false):\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?age=20\u0026id=01234\u0026zipcode=90210', {\n\ttypes: {\n\t\tage: 'number',\n\t}\n});\n//=\u003e {age: 20, id: '01234', zipcode: '90210 }\n```\n\n- `'string[]'`:  Parse `items` as an array of strings (overriding the `parseNumbers` option):\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?age=20\u0026items=1%2C2%2C3', {\n\tparseNumbers: true,\n\ttypes: {\n\t\titems: 'string[]',\n\t}\n});\n//=\u003e {age: 20, items: ['1', '2', '3']}\n```\n\n- `'number[]'`:  Parse `items` as an array of numbers (even when `parseNumbers` is false):\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?age=20\u0026items=1%2C2%2C3', {\n\ttypes: {\n\t\titems: 'number[]',\n\t}\n});\n//=\u003e {age: '20', items: [1, 2, 3]}\n```\n\n- `'Function'`: Provide a custom function as the parameter type. The parameter's value will equal the function's return value.\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?age=20\u0026id=01234\u0026zipcode=90210', {\n\ttypes: {\n\t\tage: (value) =\u003e value * 2,\n\t}\n});\n//=\u003e {age: 40, id: '01234', zipcode: '90210 }\n```\n\nNOTE: Array types (`string[]` and `number[]`) will have no effect if `arrayFormat` is set to `none`.\n\n```js\nqueryString.parse('ids=001%2C002%2C003\u0026foods=apple%2Corange%2Cmango', {\n\tarrayFormat: 'none',\n\ttypes: {\n\t\tids: 'number[]',\n\t\tfoods: 'string[]',\n\t},\n}\n//=\u003e {ids:'001,002,003', foods:'apple,orange,mango'}\n```\n\n###### Function\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('?age=20\u0026id=01234\u0026zipcode=90210', {\n\ttypes: {\n\t\tage: (value) =\u003e value * 2,\n\t}\n});\n//=\u003e {age: 40, id: '01234', zipcode: '90210 }\n```\n\nParse the value as a boolean type instead of string type if it's a boolean.\n\n### .stringify(object, options?)\n\nStringify an object into a query string and sorting the keys.\n\n#### options\n\nType: `object`\n\n##### strict\n\nType: `boolean`\\\nDefault: `true`\n\nStrictly encode URI components. It uses [encodeURIComponent](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) if set to false. You probably [don't care](https://github.com/sindresorhus/query-string/issues/42) about this option.\n\n##### encode\n\nType: `boolean`\\\nDefault: `true`\n\n[URL encode](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) the keys and values.\n\n##### arrayFormat\n\nType: `string`\\\nDefault: `'none'`\n\n- `'bracket'`: Serialize arrays using bracket representation:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'bracket'});\n//=\u003e 'foo[]=1\u0026foo[]=2\u0026foo[]=3'\n```\n\n- `'index'`: Serialize arrays using index representation:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'index'});\n//=\u003e 'foo[0]=1\u0026foo[1]=2\u0026foo[2]=3'\n```\n\n- `'comma'`: Serialize arrays by separating elements with comma:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'comma'});\n//=\u003e 'foo=1,2,3'\n\nqueryString.stringify({foo: [1, null, '']}, {arrayFormat: 'comma'});\n//=\u003e 'foo=1,,'\n// Note that typing information for null values is lost\n// and `.parse('foo=1,,')` would return `{foo: [1, '', '']}`.\n```\n\n- `'separator'`: Serialize arrays by separating elements with a custom character:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'separator', arrayFormatSeparator: '|'});\n//=\u003e 'foo=1|2|3'\n```\n\n- `'bracket-separator'`: Serialize arrays by explicitly post-fixing array names with brackets and separating elements with a custom character:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: []}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e 'foo[]'\n\nqueryString.stringify({foo: ['']}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e 'foo[]='\n\nqueryString.stringify({foo: [1]}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e 'foo[]=1'\n\nqueryString.stringify({foo: [1, 2, 3]}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e 'foo[]=1|2|3'\n\nqueryString.stringify({foo: [1, '', 3, null, null, 6]}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e 'foo[]=1||3|||6'\n\nqueryString.stringify({foo: [1, '', 3, null, null, 6]}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|', skipNull: true});\n//=\u003e 'foo[]=1||3|6'\n\nqueryString.stringify({foo: [1, 2, 3], bar: 'fluffy', baz: [4]}, {arrayFormat: 'bracket-separator', arrayFormatSeparator: '|'});\n//=\u003e 'foo[]=1|2|3\u0026bar=fluffy\u0026baz[]=4'\n```\n\n- `'colon-list-separator'`: Serialize arrays with parameter names that are explicitly marked with `:list`:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: ['one', 'two']}, {arrayFormat: 'colon-list-separator'});\n//=\u003e 'foo:list=one\u0026foo:list=two'\n```\n\n- `'none'`: Serialize arrays by using duplicate keys:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: [1, 2, 3]});\n//=\u003e 'foo=1\u0026foo=2\u0026foo=3'\n```\n\n##### arrayFormatSeparator\n\nType: `string`\\\nDefault: `','`\n\nThe character used to separate array elements when using `{arrayFormat: 'separator'}`.\n\n##### sort\n\nType: `Function | boolean`\n\nSupports both `Function` as a custom sorting function or `false` to disable sorting.\n\n```js\nimport queryString from 'query-string';\n\nconst order = ['c', 'a', 'b'];\n\nqueryString.stringify({a: 1, b: 2, c: 3}, {\n\tsort: (a, b) =\u003e order.indexOf(a) - order.indexOf(b)\n});\n//=\u003e 'c=3\u0026a=1\u0026b=2'\n```\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({b: 1, c: 2, a: 3}, {sort: false});\n//=\u003e 'b=1\u0026c=2\u0026a=3'\n```\n\nIf omitted, keys are sorted using `Array#sort()`, which means, converting them to strings and comparing strings in Unicode code point order.\n\n##### skipNull\n\nSkip keys with `null` as the value.\n\nNote that keys with `undefined` as the value are always skipped.\n\nType: `boolean`\\\nDefault: `false`\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({a: 1, b: undefined, c: null, d: 4}, {\n\tskipNull: true\n});\n//=\u003e 'a=1\u0026d=4'\n```\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({a: undefined, b: null}, {\n\tskipNull: true\n});\n//=\u003e ''\n```\n\n##### skipEmptyString\n\nSkip keys with an empty string as the value.\n\nType: `boolean`\\\nDefault: `false`\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({a: 1, b: '', c: '', d: 4}, {\n\tskipEmptyString: true\n});\n//=\u003e 'a=1\u0026d=4'\n```\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({a: '', b: ''}, {\n\tskipEmptyString: true\n});\n//=\u003e ''\n```\n\n### .extract(string)\n\nExtract a query string from a URL that can be passed into `.parse()`.\n\nNote: This behaviour can be changed with the `skipNull` option.\n\n### .parseUrl(string, options?)\n\nExtract the URL and the query string as an object.\n\nReturns an object with a `url` and `query` property.\n\nIf the `parseFragmentIdentifier` option is `true`, the object will also contain a `fragmentIdentifier` property.\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parseUrl('https://foo.bar?foo=bar');\n//=\u003e {url: 'https://foo.bar', query: {foo: 'bar'}}\n\nqueryString.parseUrl('https://foo.bar?foo=bar#xyz', {parseFragmentIdentifier: true});\n//=\u003e {url: 'https://foo.bar', query: {foo: 'bar'}, fragmentIdentifier: 'xyz'}\n```\n\n#### options\n\nType: `object`\n\nThe options are the same as for `.parse()`.\n\nExtra options are as below.\n\n##### parseFragmentIdentifier\n\nParse the fragment identifier from the URL.\n\nType: `boolean`\\\nDefault: `false`\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parseUrl('https://foo.bar?foo=bar#xyz', {parseFragmentIdentifier: true});\n//=\u003e {url: 'https://foo.bar', query: {foo: 'bar'}, fragmentIdentifier: 'xyz'}\n```\n\n### .stringifyUrl(object, options?)\n\nStringify an object into a URL with a query string and sorting the keys. The inverse of [`.parseUrl()`](https://github.com/sindresorhus/query-string#parseurlstring-options)\n\nThe `options` are the same as for `.stringify()`.\n\nReturns a string with the URL and a query string.\n\nQuery items in the `query` property overrides queries in the `url` property.\n\nThe `fragmentIdentifier` property overrides the fragment identifier in the `url` property.\n\n```js\nqueryString.stringifyUrl({url: 'https://foo.bar', query: {foo: 'bar'}});\n//=\u003e 'https://foo.bar?foo=bar'\n\nqueryString.stringifyUrl({url: 'https://foo.bar?foo=baz', query: {foo: 'bar'}});\n//=\u003e 'https://foo.bar?foo=bar'\n\nqueryString.stringifyUrl({\n\turl: 'https://foo.bar',\n\tquery: {\n\t\ttop: 'foo'\n\t},\n\tfragmentIdentifier: 'bar'\n});\n//=\u003e 'https://foo.bar?top=foo#bar'\n```\n\n#### object\n\nType: `object`\n\n##### url\n\nType: `string`\n\nThe URL to stringify.\n\n##### query\n\nType: `object`\n\nQuery items to add to the URL.\n\n### .pick(url, keys, options?)\n### .pick(url, filter, options?)\n\nPick query parameters from a URL.\n\nReturns a string with the new URL.\n\n```js\nimport queryString from 'query-string';\n\nqueryString.pick('https://foo.bar?foo=1\u0026bar=2#hello', ['foo']);\n//=\u003e 'https://foo.bar?foo=1#hello'\n\nqueryString.pick('https://foo.bar?foo=1\u0026bar=2#hello', (name, value) =\u003e value === 2, {parseNumbers: true});\n//=\u003e 'https://foo.bar?bar=2#hello'\n```\n\n### .exclude(url, keys, options?)\n### .exclude(url, filter, options?)\n\nExclude query parameters from a URL.\n\nReturns a string with the new URL.\n\n```js\nimport queryString from 'query-string';\n\nqueryString.exclude('https://foo.bar?foo=1\u0026bar=2#hello', ['foo']);\n//=\u003e 'https://foo.bar?bar=2#hello'\n\nqueryString.exclude('https://foo.bar?foo=1\u0026bar=2#hello', (name, value) =\u003e value === 2, {parseNumbers: true});\n//=\u003e 'https://foo.bar?foo=1#hello'\n```\n\n#### url\n\nType: `string`\n\nThe URL containing the query parameters to filter.\n\n#### keys\n\nType: `string[]`\n\nThe names of the query parameters to filter based on the function used.\n\n#### filter\n\nType: `(key, value) =\u003e boolean`\n\nA filter predicate that will be provided the name of each query parameter and its value. The `parseNumbers` and `parseBooleans` options also affect `value`.\n\n#### options\n\nType: `object`\n\n[Parse options](#options) and [stringify options](#options-1).\n\n## Nesting\n\nThis module intentionally doesn't support nesting as it's not spec'd and varies between implementations, which causes a lot of [edge cases](https://github.com/visionmedia/node-querystring/issues).\n\nYou're much better off just converting the object to a JSON string:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({\n\tfoo: 'bar',\n\tnested: JSON.stringify({\n\t\tunicorn: 'cake'\n\t})\n});\n//=\u003e 'foo=bar\u0026nested=%7B%22unicorn%22%3A%22cake%22%7D'\n```\n\nHowever, there is support for multiple instances of the same key:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.parse('likes=cake\u0026name=bob\u0026likes=icecream');\n//=\u003e {likes: ['cake', 'icecream'], name: 'bob'}\n\nqueryString.stringify({color: ['taupe', 'chartreuse'], id: '515'});\n//=\u003e 'color=taupe\u0026color=chartreuse\u0026id=515'\n```\n\n## Falsy values\n\nSometimes 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:\n\n```js\nimport queryString from 'query-string';\n\nqueryString.stringify({foo: false});\n//=\u003e 'foo=false'\n\nqueryString.stringify({foo: null});\n//=\u003e 'foo'\n\nqueryString.stringify({foo: undefined});\n//=\u003e ''\n```\n\n## FAQ\n\n### Why is it parsing `+` as a space?\n\nSee [this answer](https://github.com/sindresorhus/query-string/issues/305).\n","funding_links":["https://github.com/sponsors/sindresorhus","https://opencollective.com/sindresorhus","https://buymeacoffee.com/sindresorhus","https://sindresorhus.com/donate"],"categories":["JavaScript","Repository","Used by","String","String [🔝](#readme)","目录","字符串","8. 路由和链接(Routing And URLs)"],"sub_categories":["URL","Open source projects (\u003e1k⭐)","Runner","运行器","运行器e2e测试"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fquery-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsindresorhus%2Fquery-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsindresorhus%2Fquery-string/lists"}