marioizquierdo/jquery.serializeJSON — pull request #7 by kotas (2014-03-07 09:47:05+00:00)
Title: Empty index with empty value not to overwrite existing element

Hi,

I'm not sure it's by design or a bug, but I've made a patch anyway...

With a form like this:

```

```

serializeJSON returns an object:

```
{
p: [
{ foo: "foo2", bar: "bar1" },
{ foo: "", bar: "bar2" },
]
}
```

This is a bit unexpected result to me.

Although the first `p[][foo]` has a value of "empty string", serializeJSON overwrites the `foo` in the first object by the second `p[][foo]`, since it checks the absence of an element by `!lastElement[nextKey]` which results an empty string to true.