stringify array as comma separated values
See original GitHub issueHello there,
it could very nice to have ability to do something like this :
const obj = {foo: [1,2,3]};
queryString.stringify(obj, {arrayFormat: 'comma'})
And the result of this method will be: foo=1,2,3
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
How to convert array into comma separated string in javascript
The method array.toString() actually calls array.join() which result in a string concatenated by commas. ref. var array = ['a','b','c','d' ...
Read more >Convert Array to comma separated String in JavaScript
To convert an array to a comma-separated string, pass the array as a parameter to the String object - String(arr) . The String...
Read more >How to Convert an Array to Comma Separated String in Java
The simplest way to convert an array to comma separated String is to create a StringBuilder, iterate through the array, and add each...
Read more >Create a comma separated list from an array in JavaScript
The elements of the array will be separated by a specified separator. If not specified, the Default separator comma (, ) is used....
Read more >Parse and stringify comma-separated tokens - GitHub
stringify (values[, options]). Serialize an array of strings or numbers ( Array<string|number> ) to comma-separated tokens ( string ) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The thing is that every other parser will just parse this as a string. It’s not part of the spec for a very good reason. The other end can’t know if it was meant as one value or as an array of values.
foo=hello, sam
for instance. What does it mean? Was it meant as aan array? Was it meant just as a string.@nsonankar I answered it in https://github.com/sindresorhus/query-string/issues/90#issuecomment-292970631 why it doesn’t make sense to support this.