Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

parse: Empty Array fields are removed #39

Open
brianreavis opened this Issue · 2 comments

3 participants

@brianreavis

Scenario:

 photo_id[]=1
 photo_caption[]=
 photo_id[]=2
 photo_caption[]=Hello

qs.parse returns:

{
     photo_id: ['1', '2'],
     photo_caption: ['Hello']
}

The correct version should be:

{
     photo_id: ['1', '2'],
     photo_caption: ['', 'Hello']
}

Otherwise, it's impossible to maintain associations between the ordered fields.

@tj
Owner
tj commented

+1 from me though you could key them:

> require('qs').parse('photo[foo][id]=1&photo[foo][caption]=hey')
{ photo: { foo: { id: '1', caption: 'hey' } } }
@daguej

This is still an issue, however you could use the built-in querystring module as a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.