From 8bd4c6cf12898f469838980317fec92007e5112a Mon Sep 17 00:00:00 2001 From: Evan Sharp Date: Tue, 17 Jan 2017 12:39:16 -0500 Subject: [PATCH] Document allowDots option for stringify --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 23211c9f..1ec74627 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,20 @@ qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) // 'a=b&a=c' ``` +When objects are stringified, by default they use bracket notation: + +```javascript +qs.stringify({ a: { b: { c: 'd', e: 'f' } } }); +// 'a[b][c]=d&a[b][e]=f' +``` + +You may override this to use dot notation by setting the `allowDots` option to `true`: + +```javascript +qs.stringify({ a: { b: { c: 'd', e: 'f' } } }, { allowDots: true }); +// 'a.b.c=d&a.b.e=f' +``` + Empty strings and null values will omit the value, but the equals sign (=) remains in place: ```javascript