Skip to content

Arrays of objects #42

@RangerMauve

Description

@RangerMauve

I have something that looks like this:

<input name="foo[0][bar]" value="a"/>
<input name="foo[0][baz]" value="b"/>
<input name="foo[1][bar]" value="c"/>
<input name="foo[1][baz]" value="d"/>

This is being parsed as

{
  "foo": {
    "0": {"bar": "a", "baz": "b"},
    "1": {"bar": "b", "baz": "c"},
  }
}

Since the keys are numbers, I would have expected it to parse it as an array, as so:

{
  "foo": [
   {"bar": "a", "baz": "b"},
   {"bar": "b", "baz": "c"},
  ]
}

I think this is a reasonable setting to use since numeric keys are already used for arrays of strings.

Would a PR for this change be welcome?

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