> jQuery.param({a:{'0':1,x:4}})
'a%5B0%5D=1&a%5Bx%5D=4'
> jqueryDeparam(jQuery.param(jqueryDeparam(jQuery.param({a:{'0':1,x:4}}))))
{ a: [ '1' ] }
> jqueryDeparam(jQuery.param(jqueryDeparam(jQuery.param({a:{'0':1,x:4}})))).a.x
undefined
> jqueryDeparam(jQuery.param({a:{'0':1,x:4}})).a.x
'4'
> typeof jqueryDeparam(jQuery.param({a:{'0':1,x:4}})).a
'object'
> jQuery.isArray(jqueryDeparam(jQuery.param({a:{'0':1,x:4}})).a)
true
An object with numeric keys is encoded in the same way as an array by jQuery.param(). jQuery.param() will, like JSON.stringify(), ignore any string keys on an array object when serializing. However, this package, jquery-deparam assumes that an object is an array if the first key name it encounters is numeric.
jquery-param treats things as arrays sometims when it shouldn’t. As a result, the transform becomes lossy.
An object with numeric keys is encoded in the same way as an array by
jQuery.param().jQuery.param()will, likeJSON.stringify(), ignore any string keys on an array object when serializing. However, this package, jquery-deparam assumes that an object is an array if the first key name it encounters is numeric.jquery-param treats things as arrays sometims when it shouldn’t. As a result, the transform becomes lossy.