Skip to content

Commit

Permalink
[readme] stringify: clarify default arrayFormat behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Sep 14, 2023
1 parent 410bdd3 commit 6c26f8a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -375,14 +375,14 @@ var decoded = qs.parse('x=z', { decoder: function (str, defaultDecoder, charset,

Examples beyond this point will be shown as though the output is not URI encoded for clarity. Please note that the return values in these cases *will* be URI encoded during real usage.

When arrays are stringified, by default they are given explicit indices:
When arrays are stringified, they follow the `arrayFormat` option, which defaults to `indices`:

```javascript
qs.stringify({ a: ['b', 'c', 'd'] });
// 'a[0]=b&a[1]=c&a[2]=d'
```

You may override this by setting the `indices` option to `false`:
You may override this by setting the `indices` option to `false`, or to be more explicit, the `arrayFormat` option to `repeat`:

```javascript
qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false });
Expand Down

0 comments on commit 6c26f8a

Please sign in to comment.