GO
qs-stringify
Simple query stringify with nesting.
Install
npm install qs-stringifyUsage
var stringify = require('qs-stringify')
stringify({
page: {
offset: 50,
limit: 25
},
filter: 'hello world'
})
// → "page[offset]=50&page[limit]=25&filter=hello%20world"You can also use ES modules.
import stringify from 'qs-stringify'Query string shape
This module expects that you know the shape of the query string you want to print, and only does trivial serialization of strings, numbers, and nested objects.
This is very much intentional: a query string is part of a URL, and should be stable and intentional.
You should not blindly serialize state objects into a query string, and URLs should continue to work if your state shape changes.
If you want to use other types or do custom serialization, fit them into a supported shape first:
var stringify = require('qs-stringify')
var startAt = new Date()
var filterTags = ['work', 'home']
stringify({
tags: filterTags.join(','),
startAt: startAt.toISOString(),
})
// → "tags=work,home&startAt=2024-10-15T20%3A22%3A36.883Z"License
On this page
Languages
JavaScript100.0%
MIT License
Created September 13, 2017
Updated March 2, 2026