{"library":"qs","title":"qs: Querystring Parser and Stringifier","description":"qs is a robust JavaScript library for parsing and stringifying URL query strings, with comprehensive support for nesting objects and arrays. It is currently on version 6.15.1 and maintains a steady release cadence with a focus on stability and security patches. Key differentiators include its configurable depth limits for parsing, the ability to handle URI-encoded strings, and built-in protections against prototype pollution through options like `plainObjects` and `allowPrototypes` (which is dangerous if enabled). Unlike the native `querystring` module in Node.js, `qs` offers more advanced features like array indexing and custom parsing/stringifying logic, making it suitable for complex data structures often found in web applications.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install qs"],"cli":null},"imports":["const qs = require('qs');","const { parse } = require('qs');","const qs = require('qs');\nconst stringify = qs.stringify;"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const qs = require('qs');\nconst assert = require('assert');\n\n// Parsing a simple querystring\nlet obj = qs.parse('a=c&b=d');\nassert.deepEqual(obj, { a: 'c', b: 'd' });\n\n// Stringifying an object\nlet str = qs.stringify({ a: 'c', b: 'd' });\nassert.equal(str, 'a=c&b=d');\n\n// Parsing a nested object\nobj = qs.parse('foo[bar]=baz');\nassert.deepEqual(obj, { foo: { bar: 'baz' } });\n\n// Parsing an array\nobj = qs.parse('a=b&a=c');\nassert.deepEqual(obj, { a: ['b', 'c'] });\n\n// Demonstrating depth limit (default 5)\nconst deepString = 'a[b][c][d][e][f][g]=h';\nobj = qs.parse(deepString);\nassert.deepEqual(obj, {\n    a: {\n        b: { c: { d: { e: { f: { '[g]': 'h' } } } } }\n    }\n});\n\nconsole.log('All assertions passed!');","lang":"javascript","description":"Demonstrates basic `qs.parse` and `qs.stringify` functionality, including nested objects, arrays, and the default depth limit behavior.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}