question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

stringify array as comma separated values

See original GitHub issue

Hello 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:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SamVerschuerencommented, Apr 10, 2017

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.

0reactions
SamVerschuerencommented, Feb 7, 2018

@nsonankar I answered it in https://github.com/sindresorhus/query-string/issues/90#issuecomment-292970631 why it doesn’t make sense to support this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found