js-url icon indicating copy to clipboard operation
js-url copied to clipboard

Issues parsing arguments that are arrays with non-numeric keys

Open maxguru opened this issue 8 years ago • 0 comments

There seems to be an issue parsing non-numeric keys in array arguments. Check out the following,

> JSON.stringify(url('?','?t[0]=x&t[1]=y'));
"{"t":["x","y"]}"
> JSON.stringify(url('?','?t[a]=x&t[b]=y'));
"{"t[a]":"x","t[b]":"y"}"

The expected behavior is,

> JSON.stringify(url('?','?t[0]=x&t[1]=y'));
"{"t":["x","y"]}"
> JSON.stringify(url('?','?t[a]=x&t[b]=y'));
"{"t":{"a":"x","b":"y"}}"

maxguru avatar Mar 06 '18 06:03 maxguru