brainfoolong / form-data-json

A zero dependency, cross browser library to easily get or set/manipulate form input values as/from a json object.
https://brainfoolong.github.io/form-data-json
MIT License
60 stars 10 forks source link

Name syntax with dot #26

Closed Nazar84 closed 2 years ago

Nazar84 commented 2 years ago

Hi! Now to specify nesting I have to use '[ ]' in field name.

Maybe It would be more convenient to use '.' Example (something like this):

<input name="Company[Phone][0][phone]" type="text" value="34343">
<input name="Company.Phone[0]phone" type="text" value="34343">

Where the data is:

{
 Company: {
  Phone: [{
     phone: 34343,
   }],
 },
}
brainfoolong commented 2 years ago

Hi. A dot is invalid - Or let's say, a problem, here. On form submit it get converted to underscore, so this is no option as it would expect names that are absolutely should be avoided in production. It is solely syntactic sugar.

Nazar84 commented 2 years ago

Ok, I`v got you. Thanks!