Skip to content

Bad parse when turning array into object #74

Closed
@dougwilson

Description

@dougwilson
Contributor

The following shows that when a key starts as an array, values that match Object.prototype keys are basically treated as if they are just an empty bracket for some reason. I would not expect the 1 property to exist in the example below:

$ node -pe 'require("qs").parse("a[]=b&a[hasOwnProperty]=c&a[x]=y")'
{ a: { '0': 'b', '1': 'c', x: 'y' } }

$ node -pe 'require("qs/package").version'
2.4.1

Activity

dougwilson

dougwilson commented on Mar 15, 2015

@dougwilson
ContributorAuthor

And the following parse is even more bizarre:

$ node -pe 'require("qs").parse("a[]=b&a[t]=u&a[hasOwnProperty]=c")'
{ a: { '0': 'b', t: 'u', c: true } }
self-assigned this
on Mar 18, 2015
nlf

nlf commented on May 21, 2015

@nlf
Collaborator

this is related to #80

added this to the 3.0.0 milestone on May 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @ljharb@dougwilson@nlf

      Issue actions

        Bad parse when turning array into object · Issue #74 · ljharb/qs