express icon indicating copy to clipboard operation
express copied to clipboard

bodyParsing and embedded arrays not parsing correctly

Open reedyrm opened this issue 13 years ago • 1 comments

Ran into an issue with parsing arrays

<input type="text" name="parent[item[0][name]]">
<input type="text" name="parent[item[0][price]]">

The follow is parsed successfully, but each item object is saved as

{ 'name]': '4', 'price]': '5' } where the brace is added to the object

under

req.body.parent.item[0]

I understand there is a workaround where I can just collapse it down to

<input type="text" name="item[0][name]">
<input type="text" name="item[0][price]">

so it parses correctly as req.body.item[0].

reedyrm avatar Jan 17 '13 07:01 reedyrm

this should be moved to https://github.com/visionmedia/node-querystring, that's the lib Connect uses, however I haven't seen that syntax in use before personally

tj avatar Jan 24 '13 04:01 tj