Skip to content

Infer arrays from duplicate nested names #38

@greypants

Description

@greypants

Values serialize into arrays just fine when they're not nested, but when they are, only the last value is used and serializes as a string:

<input type="text" name="nested[colors]" value="red" />
<input type="text" name="nested[colors]" value="green" checked />
<input type="text" name="nested[colors]" value="blue" checked />

Expected Output:

{ 
  nested: {
    colors: ["green", "blue"]
  }
}

Actual Output:

{ 
  nested: {
    colors: "blue"
  }
}

I can work around it if I explicitly add [] to the names, but it seems like it should work without that. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions