Skip to content

Instantly share code, notes, and snippets.

@ThaddeusJiang
Created June 26, 2021 23:43
Show Gist options
  • Save ThaddeusJiang/972216c0f1075f9e34fe904387b56b6b to your computer and use it in GitHub Desktop.
Save ThaddeusJiang/972216c0f1075f9e34fe904387b56b6b to your computer and use it in GitHub Desktop.
query string arrayFormat Examples
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' })
// 'a[0]=b&a[1]=c'
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' })
// 'a[]=b&a[]=c'
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' })
// 'a=b&a=c'
qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'comma' })
// 'a=b,c'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment